Jump to content

Tokei

Members
  • Posts

    662
  • Joined

  • Last visited

  • Days Won

    90

Everything posted by Tokei

  1. Alright, I see what Gravity did there... Updated with 1.8.4.9, should fix the gat type problems.
  2. Heya, This tool parses replay files (rrf) and outputs a readable format. It is used to gather data from official replay files by extracting NPC dialogues, quest status, skill cast time, after-cast delay, etc. Say you want to replicate an official instance, you would get a replay of it and then extract the data using this tool. You'll be able to follow along the mes dialogues, the next statements, etc, when making the actual script. You can save a lot of time doing so. It is a tool I've been using heavily for many years now and it was made to fit my needs, so some stuff may not seem very useful to you. Because of this, I'm making the project public so you're free to add more features/information as you see fit. The source for the Replay format as far as I'm aware is from Dia (from Divine Pride), so huge thanks on that side. Download: https://github.com/Tokeiburu/Rrf-Parser/releases Git repo: https://github.com/Tokeiburu/Rrf-Parser Some replays may not work as this tool was made specifically for kRO replays (and I've been removing support for older versions throughout the years). How it works Change the replay path to your replay and click "Parse Replay" to start the process. Once that's done, you should get the output shown above. Choose the parsing options on the left if you don't want to include useless data. It may be useful for some though. The [output] options are files generated in your folder\output\file.txt. Main output NPC scripts. All the NPCs that have been seen (in order) will be put there with a pre-made script. It will also show "npc_avail" for some very specific NPCs. On kRO, some NPCs don't actually have a view ID but are actually characters with a style. This is what npc_avail is for (though it's not something rAthena supports at the moment). For example: 1@exnw,12,107,3 script ³ªÀÌÆ® ¿öÄ¡#nw3 npc_avail[4306,0,21,7,0,0,0,0,0,0,0],{ end; } Which corresponds to: p.job,p.sex,p.head,p.headpalette,p.weapon,p.shield,p.accessory,p.accessory2,p.accessory3,0,p.bodypalette Equipment. The next entry in the main output is the player equipment with the @item2 command to remake the gears quickly. This only includes equipped items. The other pieces of equipment in the inventory are not included there. Monster spawned. This part will include all the monsters that have spawned and it will not show them more than once. Packet output. That is the main part of the parsed script. It will give you the script lines, cutins, and much more. It will detect cloakoffnpcself, but don't trust the output blindly either. Sometimes kRO just hides a NPC for dumb reasons. Though usually it should be accurate. Parsing options Most of the fields are self-explanatory, so I'll only go over those that aren't. Show raw packets. Outputs the packets in hexadecimals rather than a readable format. Revert instance names. Looks for ###1@name in map names and reverts it back to the original map name. This also changes NPC names that got converted such as something#ins_0o1 to something#ins. Generic packet. This one contains pretty much everything not included in the other options. UnitWalk packet. This one is disabled by default, but you might consider turning it on if you're doing newer instances because kRO uses those a lot lately. When a NPC moves, it will be shown there. mob_data.conf A special file is generated alongside the replay in the output folder called "mob_data.conf" (though it's not a real libconf format). The mob_data.conf file contains data gathered from the mobs inside the replay such as mob level, speed, damage motion, attack motion, boss type, skills used and mob drops. As far as mob drops go however, be careful as the tool makes a lot of estimation there. For example: Mob Death: 148 Drops: 1000364,135 Dropped: 2 The above means the mob has been killed 148 times, and only one drop has been seen (1000364). The estimated drop rate is 1.35%. A drop is defined as an item dropped alongside the unit_dead packet. So it may be wrong, or if the mob is looter type, you'll get a bunch of invalid results. Though usually it's a fair estimation. Tool > Translation helper So if you put the following as the input: select("¾îµð·Î °¡¸é µÇÁÒ?:"); // TICK: 19263 ms, INTERVAL: 0, FORMAT: 0:19 mes "[¸¶¶÷]"; // TICK: 19746 ms, INTERVAL: 433, FORMAT: 0:19 mes "¾ÆÀÌ»þ°¡ ¾îµð¼­ »ì¾ÒÁö? ¾Æ! ÀÌ <NAVI>[À­ÂÊ]<INFO>wolfvill,99,178,0,101,0</INFO></NAVI>¿¡ °¡¸é ¾ÆÀÌ»þÀÇ ÁýÀÌ ÀÖ¾î¿ä."; // TICK: 19746 ms, INTERVAL: 0, FORMAT: 0:19 next; // TICK: 19746 ms, INTERVAL: 0, FORMAT: 0:19 mes "[½ºÄ«´Ï¾Æ]"; // TICK: 20129 ms, INTERVAL: 0, FORMAT: 0:20 mes "ÇÏÁö¸¸ ¸»Çصµ ¼Ò¿ë ¾øÀ» °É¿ä? ¼³µæÇÑ´Ù¸é, ´ç½Å¿¡ ´ëÇÑ ³» »ý°¢µµ ¹Ù²ÙÁÒ."; // TICK: 20129 ms, INTERVAL: 0, FORMAT: 0:20 npctalk "½ºÄ«´Ï¾Æ, ¸ðÇè°¡´ÔÀº ³× »ý°¢À¸·Î °¡Ä¡°¡ Æò°¡µÇ´Â ºÐÀÌ ¾Æ´Ï¼Å.", "¸¶¶÷#wms01"; // TICK: 20129 ms, INTERVAL: 0, FORMAT: 0:20 npctalk "´©°¡ ¹¹·¡? ÀßÇØÁÙ °Å¶ó°í.", "½ºÄ«´Ï¾Æ#wms01"; // TICK: 20129 ms, INTERVAL: 0, FORMAT: 0:20 next; // TICK: 20129 ms, INTERVAL: 0, FORMAT: 0:20 mes "[¸¶¶÷]"; // TICK: 20479 ms, INTERVAL: 33, FORMAT: 0:20 mes "¸ðÇè°¡´Ô, ±×·³ ´Ù³à¿À¼¼¿ä! ³ªµµ À̸¸ °¥°Ô!"; // TICK: 20479 ms, INTERVAL: 0, FORMAT: 0:20 setquest 17510; // State = 1, Time = 0 // TICK: 20479 ms, INTERVAL: 0, FORMAT: 0:20 close; // TICK: 20480 ms, INTERVAL: 1, FORMAT: 0:20 You would get the following as the output: 어디로 가면 되죠? [마람] 아이샤가 어디서 살았지? 아! 이 [윗쪽]에 가면 아이샤의 집이 있어요. <NAVI>[윗쪽]<INFO>wolfvill,99,178,0,101,0</INFO></NAVI> [윗쪽] next; [스카니아] 하지만 말해도 소용 없을 걸요? 설득한다면, 당신에 대한 내 생각도 바꾸죠. 스카니아, 모험가님은 네 생각으로 가치가 평가되는 분이 아니셔. 누가 뭐래? 잘해줄 거라고. next; [마람] 모험가님, 그럼 다녀오세요! 나도 이만 갈게! setquest 17510; close; It extracts the content and puts them in Korean for easier google/papago translate copy paste. The "select" content will be extracted, same for <NAVI> and a few other annoying cases where you end up spending more time removing the tags than actually translating. Tool > Replay simulation This one is meant to "transform" a replay into a script so that you can view it on your own server. The input account ID is your account id, on the test server you'll be on. This is required for the script to work correctly. You will get an output similar to - script REPLAY_SIMULATION -1,{ end; OnTimer1: attachrid(2000012); sendpacket("ff09620006aa010000000000002c0100000000040000008928000000000000000000000000000000000000000000000000000000000000000000000000000024472500000000000000ffffffffffffffff000000b9ccb8aebecf23657031385f7776"); sendpacket("ff09600006a9010000000000002c0100000000040000008828000000000000000000000000000000000000000000000000000000000000000000000000000023c72500000000000000ffffffffffffffff000000b8b6b6f723657031385f7776"); sendpacket("ff09620006ab010000000000002c0100000000000000008b28000000000000000000000000000000000000000000000000000000000000000000000000000023c71500000000000000ffffffffffffffff000000c0ccb9c7b8b123657031385f7776"); end; OnInit: initnpctimer; end; } Then load the script and your character will redo what the replay file was doing. You'll probably have to put your character where the replay starts as otherwise some weird stuff is gonna happen. You'll also need the following script command as well: BUILDIN_DEF(sendpacket,"s"), BUILDIN_FUNC(sendpacket) { const char *input = script_getstr(st,2); struct block_list *bl = map_id2bl(st->rid); unsigned char buf[10000]; int len = strlen(input); int i; for (i = 0; i < len; i += 2) { sscanf(&input[i], "%2hhx", &buf[i/2]); } if (!bl) { npc_timerevent_stop(map_id2nd(st->oid)); st->state = END; return SCRIPT_CMD_FAILURE; } clif_send(buf, len / 2, map_id2bl(st->rid), SELF); return SCRIPT_CMD_SUCCESS; } Notes This is a tool I do not plan on spending a whole lot of time on. It would be a nightmare to maintain in the first place. I will add requested features if any for a short time, but it would be much easier to add such features yourself if you are planning to use this as a base for your own needs. If you want to handle a new packet, simply go in RrfParser\Packet\PacketDecoder.cs and add it as you want. Only those I needed were handled. The display timers are both useful and annoying. Once I'm done with a script, I usually run a quick regex to wipe out all comments and that solves that problem. //.*
  3. These use a new GND format, weird. I've added support for those maps in 1.8.4.8. (There may be more problematic maps? Hopefully not, but let me know if there still are.)
  4. Fixed a couple months ago; please update to the latest version.
  5. Heya, It took me a while to figure out what you were trying to do. You're trying to edit the client aura effect using the NEMO/WARP patch for more aura options, instead of creating custom hat effects from the guide. That's why you don't see a STR file in your folder. Those are two completely different features and you can't really mix them. Now I can't help you if you're going with the first option since those effects are read directly by the client and therefore do not have STR files. You also can't edit them at all besides changing the BMP file. The guide you're following provided you with a zip in step 4 which contains what you actually need for making custom hat effects (not auras). So assuming you've followed the previous steps in the guide, and you defined your new hat effect as this... HAT_EF_Angelic_Aura = 181 //... [HatEFID.HAT_EF_Angelic_Aura] = { resourceFileName = "effect\\angelic_aura\\angelic_aura.str", hatEffectPos = -6, hatEffectPosX = 0, isIgnoreRiding = true, isAdjustPositionWhenShrinkState = true, isAdjustSizeWhenShrinkState = true } You now have two methods when creating a new hat effect: change the textures or customize it. If you're only going to change the textures, which is what most people end up doing, then it's fairly easy. Duplicate the aura from the example in step 4, then overwrite the textures with your own and that's pretty much it. If you want to do more edits and more "fancy" stuff with your auras, then here's an example below: Open an existing STR file (arcana_aura.str, from your guide's example). Do whatever changes you want in the STR. I'm adding a second layer that I duplicated and then used a random texture I found somewhere. Save the file to wherever you want, as long as it matches with your resourceFileName. (I'm ignoring the particle effect on top that they're showing you in the guide, that part is up to you.)
  6. Well, auras are str files to begin with, no? You could open an existing aura, change the textures to your files, and save it again for a quick custom aura.
  7. The quadtree isn't meant for something like that; it's a bandaid for BrowEdit 1 that didn't build the quadtree properly (related to black square issues). Though that's long been fixed by now. There's no such feature to convert to Blender or other common 3D formats from GRF Editor. Your best bet would be to look at BrowEdit 3 (https://github.com/Borf/BrowEdit3/releases), though... I don't think such a feature is available there either? Either way, GRF Editor is quite bare-bone and unoptimized as far as managing 3D assets goes. You may want to look into these projects:
  8. Heya, I've removed the GRF Editor sources from public view a long time ago, but I don't mind adding them back now. You'll have to set the startup project to GrfCL, you can find the project here: https://github.com/Tokeiburu/GRFEditor
  9. Hmm, which software was used to create these? The integer for the frame count is written in plain text with "Fram". That looks like a bug when saving the file. I can't really retrieve that value perfectly, but I can guess it while loading the file and make an estimate. __ Updated to 1.0.8: Fixed the issue above. Added Flip Horizontal/Vertical transformations. Added a new button "Group Edit" to modify multiple frames at the same time. The available transformations for Group Edit are translation, rotation and flip.
  10. Well, it looks like there are more than one error there...? Your output is very confusing. I'd probably recommend you make sure .net 3.5 and .net 4.0 are installed for starter.
  11. Well, you'd have to check which palette it actually uses in your case. If it's cardinal, then it's most likely using cardinal_³²_2.pal. The default kRO palettes for 4th classes are not compatible with the fixed sprites that private servers use (and not compatible with older sprites either, such as a GM sprite). So to make the 4th class palette compatible with your GM sprite, you'll have to use custom palettes instead. I'm not sure how's the progress on those; I made mine myself but I'm sure someone out there made them available to everyone by now. If you use custom palettes, then you'll obviously also have to use one of the "4th Jobs Corrected Sprites" pack available on rAthena.
  12. Unfortunately, that's not possible at all right now for various compatibility reasons. For saving it as a gif, the output would also have to be rendered with OpenGL, on an actual window, which a console application doesn't have.
  13. I mean, read the error message and it will tell you what the problem is/how to fix it.
  14. var path = @"C:\test\"; foreach (var actFile in Directory.GetFiles(path, "*.act")) { var sprFile = actFile.ReplaceExtension(".spr"); var act2 = new Act(actFile, sprFile); foreach (var action in act2) { action.Frames = action.Frames.Take(1).ToList(); } act2.SaveWithSprite(actFile, sprFile); }
  15. The palette used depends of your class, so it's somewhat unrealistic to give palettes for the GM sprite as it can be any class. Plus, each server has different palettes, so only your related server can create those.
  16. I don't understand your question, sorry. Can you phrase it differently?
  17. What part is not working for you? It removes all frames except the first one for me.
  18. That's problematic because the mobs are loaded from script files. If you reload a script without removing the mobs prior, you'll end up with twice as many mobs on the map (and it will keep increasing if you reload the file again). Also, you might want to get away from using @reloadscript as a whole. That command is only really useful to reload mobs... Instead, I'd recommend looking into "@reloadnpcfile npc/custom/test.txt". It will unload and reload only a specific file without having to reload your whole server scripts. It's much faster and efficient.
  19. Well, do you have maps in your input folder? If you aren't using the input folder, you have to check the "Use this GRF" box.
  20. Well, there's some information missing on what you're trying to achieve there. Do you actually need this particular file? A translated one would probably be better for you. So as Winter above said, using the file from a translated git repository might be a better. Though if you do want to extract this particular file (which I assume is from data.grf; from kRO), then use "Save as..." and save the file wherever you want (make sure to save it as skillinfolist.lub, not lua). You should also change the view by clicking on "Raw view" as well. If you're going to copy the file from kRO, you'll probably run into missing defined skills from skillid.lub, but again it depends what you're trying to achieve. Mixing lub files isn't a good idea if you don't know what you're doing.
  21. Well, something's most likely wrong somewhere with your _battle_data value(s). The error's too vague to be more precise though, but... You could simply check for the changes you've made in battle.cpp using your git logs to see what was pushed to it.
  22. Well, the file air_evt is probably encrypted, so you can't make it into a flat map. As for the cities, well, the files may be in another GRF which takes priority over your data.grf. I would presume they are in whateverRO.grf. Either way, it'd be easier to make yourself a new grf, like maps.grf and then put it as the highest priority possible in your data.ini.
  23. Well, same way you're patching your iteminfo. If you're using GRF Editor to make your thor files, then drop the files in "root":
  24. Heya, Did you check if the char-server has loaded properly first? The map-server will not connect to the char-server unless the char-server is loaded, so you might want to check that. It should be saying "Awaiting maps from map-server." For inter-server connections, you should also use the localhost IP (127.0.0.1). This goes for map-server to char-server and char-server to login-server. Regardless of your server being public or not, inter-server connections should remain in a "closed" system. But ultimately, since you're using your private IP to connect right now, it would seem to indicate there is also a problem with your port configuration. So make sure port 6121 is forwarded to 192.168.1.14 in your router configuration. Note that this step is only required if you plan to make your server public. You should make sure that the server can run locally first using the localhost IP.
  25. Heya, These script commands are an alternative for those who do not want to use yaml for making barter shops. The shops can be reloaded by reloading the script, using the barter_clear command. The NPC location is defined just like a regular NPC and then using callshop <npc barter name>, just like regular shop types (which is already possible without this diff, but I thought I'd mention it anyway). Removes all items from a barter shop barter_clear <npc name>; Add item, not extended barter_add <npc name>,<item id>,<amount>,<req item id>,<req amount>; Add item, extended barter_add_ex <npc name>,<item id>,<amount>,<zeny>{,<req item id>,<req amount>,<req refine>}*; Here's a script example: prontera,150,188,0 script Barter NPC 77,{ mes "[Barter NPC]"; next; switch(select("Normal barter shop.:Extended barter shop.:")) { case 1: mes "[Barter NPC]"; mes "..."; close2; callshop "barter_test_npc"; end; case 2: mes "[Barter NPC]"; mes "..."; close2; callshop "barter_test_npc_ex"; end; } end; OnInit: barter_clear "barter_test_npc"; barter_add "barter_test_npc", 504, 10, 501, 20; barter_add "barter_test_npc", 504, 10, 502, 10; barter_add "barter_test_npc", "White_Potion", 10, "Yellow_Potion", 3; barter_clear "barter_test_npc_ex"; barter_add_ex "barter_test_npc_ex", "Zeny_Knife", 5, 5000, "Knife", 1, 9; barter_add_ex "barter_test_npc_ex", "Zeny_Knife", 5, 5000, "Knife", 1, 9, "White_Potion", 10, 0; barter_add_ex "barter_test_npc_ex", "Zeny_Knife", 5, 5000, "Knife", 1, 9, "White_Potion", 10, 0, "White_Potion", 10, 0; end; } prontera,152,188,0 script Barter NPC2 77,{ callshop "barter_test_npc"; end; } And here's the diff file: diff --git a/src/map/npc.cpp b/src/map/npc.cpp index d227467ed..37f50d94d 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -842,6 +842,26 @@ void BarterDatabase::loadingFinished(){ BarterDatabase barter_db; +struct npc_data* npc_create_dummy_barter_npc(const char *npcname) { + struct npc_data* nd = npc_create_npc(-1, 0, 0); + + npc_parsename(nd, npcname, nullptr, nullptr, __FILE__ ":" QUOTE(__LINE__)); + + nd->class_ = -1; + nd->speed = 200; + + nd->bl.type = BL_NPC; + nd->subtype = NPCTYPE_BARTER; + + nd->u.barter.extended = false; + + map_addiddb(&nd->bl); + + strdb_put(npcname_db, npcname, nd); + + return nd; +} + /** * Returns the viewdata for normal NPC classes. * @param class_: NPC class ID diff --git a/src/map/npc.hpp b/src/map/npc.hpp index 0a0c104e6..82ad2cf3d 100644 --- a/src/map/npc.hpp +++ b/src/map/npc.hpp @@ -1479,6 +1479,8 @@ enum e_npcv_status : uint8 { NPCVIEW_INVISIBLE = 0x29, NPCVIEW_CLOAK = 0x30, }; + +struct npc_data* npc_create_dummy_barter_npc(const char* npcname); struct view_data* npc_get_viewdata(int class_); int npc_chat_sub(struct block_list* bl, va_list ap); int npc_event_dequeue(map_session_data* sd,bool free_script_stack=true); diff --git a/src/map/script.cpp b/src/map/script.cpp index 5aeebe228..6742ab8c4 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -26916,6 +26916,154 @@ BUILDIN_FUNC(preg_match) { #endif } +/*========================================== + * Removes all items from a barter shop + * barter_clear <npc name>; + *------------------------------------------*/ +BUILDIN_FUNC(barter_clear) +{ + const char* npcname = script_getstr(st, 2); + std::shared_ptr<s_npc_barter> barter = barter_db.find(npcname); + + if (barter != nullptr) { + barter->items.clear(); + } + + return SCRIPT_CMD_SUCCESS; +} + +/*========================================== + * Add an item to the barter shop + * Not extended: + * barter_add <npc name>,<item id>,<amount>,<req item id>,<req amount>; + * + * Extended: + * barter_add_ex <npc name>,<item id>,<amount>,<zeny>{,<req item id>,<req amount>,<req refine>}*; + *------------------------------------------*/ +BUILDIN_FUNC(barter_add) +{ + const char* npcname = script_getstr(st, 2); + std::shared_ptr<s_npc_barter> barter = barter_db.find(npcname); + struct npc_data* nd = npc_name2id(npcname); + const char* command = script_getfuncname(st); + + if (barter == nullptr) { + barter = std::make_shared<s_npc_barter>(); + barter->name = npcname; + barter_db.put(npcname, barter); + } + + if (nd == nullptr) { + nd = npc_create_dummy_barter_npc(npcname); + } + + int index = barter->items.size(); + + std::shared_ptr<s_npc_barter_item> item = std::make_shared<s_npc_barter_item>(); + item->index = index; + barter->items[index] = item; + + if (strcmpi(command, "barter_add_ex") == 0) { + nd->u.barter.extended = true; + + if (script_isstring(st, 3)) { + const char* name = script_getstr(st, 3); + + std::shared_ptr<item_data> id = item_db.searchname(name); + + if (id == nullptr) { + ShowError("buildin_barter_add: Nonexistant item %s\n", name); + return SCRIPT_CMD_FAILURE; + } + + item->nameid = id->nameid; + } + else { + item->nameid = script_getnum(st, 3); + } + + item->stock = script_getnum(st, 4); + item->stockLimited = false; + item->price = script_getnum(st, 5); + + int offset = 6; + + while (script_hasdata(st, offset) && script_hasdata(st, offset + 1) && script_hasdata(st, offset + 2)) { + std::shared_ptr<s_npc_barter_requirement> requirement = std::make_shared<s_npc_barter_requirement>(); + + requirement->index = (uint16)item->requirements.size(); + + if (script_isstring(st, offset)) { + const char* name = script_getstr(st, offset); + + std::shared_ptr<item_data> id = item_db.searchname(name); + + if (id == nullptr) { + ShowError("buildin_barter_add: Nonexistant item %s\n", name); + return SCRIPT_CMD_FAILURE; + } + + requirement->nameid = id->nameid; + } + else { + requirement->nameid = script_getnum(st, offset); + } + + requirement->amount = script_getnum(st, offset + 1); + requirement->refine = script_getnum(st, offset + 2); + item->requirements[requirement->index] = requirement; + offset += 3; + } + } + else { + nd->u.barter.extended = false; + + if (script_isstring(st, 3)) { + const char* name = script_getstr(st, 3); + + std::shared_ptr<item_data> id = item_db.searchname(name); + + if (id == nullptr) { + ShowError("buildin_barter_add: Nonexistant item %s\n", name); + return SCRIPT_CMD_FAILURE; + } + + item->nameid = id->nameid; + } + else { + item->nameid = script_getnum(st, 3); + } + + item->stock = script_getnum(st, 4); + item->stockLimited = false; + + std::shared_ptr<s_npc_barter_requirement> requirement = std::make_shared<s_npc_barter_requirement>(); + + requirement->index = 0; + + if (script_isstring(st, 5)) { + const char* name = script_getstr(st, 5); + + std::shared_ptr<item_data> id = item_db.searchname(name); + + if (id == nullptr) { + ShowError("buildin_barter_add: Nonexistant item %s\n", name); + return SCRIPT_CMD_FAILURE; + } + + requirement->nameid = id->nameid; + } + else { + requirement->nameid = script_getnum(st, 5); + } + + requirement->amount = script_getnum(st, 6); + item->requirements[0] = requirement; + } + + return SCRIPT_CMD_SUCCESS; +} + /// script command definitions /// for an explanation on args, see add_buildin_func struct script_function buildin_func[] = { @@ -27623,6 +27771,10 @@ struct script_function buildin_func[] = { BUILDIN_DEF(isdead, "?"), BUILDIN_DEF(macro_detector, "?"), + BUILDIN_DEF(barter_clear, "s"), + BUILDIN_DEF(barter_add, "svi*"), + BUILDIN_DEF2(barter_add, "barter_add_ex", "svii*"), + #include "../custom/script_def.inc" {NULL,NULL,NULL}, Quick notes: There isn't a whole lot of error handling. Do... not use an existing NPC name for the barter name if you don't want to crash, but otherwise, should be fine! There is no handling for stocks. You can add parameters to it in the script command if you feel like it, but I've personally never used this option so I just didn't add it. barter.diff
×
×
  • Create New...