Jump to content

Amun

Contributor
  • Posts

    199
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    100%

Amun last won the day on October 18 2022

Amun had the most liked content!

6 Followers

About Amun

Informations

  • Country
    Niger

Social Networks

  • Discord
    Amun#3808

Recent Profile Visitors

1681 profile views

Amun's Achievements

Proficient

Proficient (10/16)

  • Problem Solver Rare
  • Very Popular Rare
  • Very Important Person Rare
  • Dedicated
  • Reacting Well

Recent Badges

1.7k

Reputation

  1. Mf, they just pointed out an error, you don't need to act like a 15yo fucking princess with daddy issues. void SmhTMap::OnSetItemMonster(LPCHARACTER pkChar, LPITEM pkItem, LPCHARACTER pkMonster) { if (!pkChar) return; if (!pkItem) return; if (!pkMonster) return; // if (pkItem)// this is fucking useless ITEM_MANAGER::instance().RemoveItem(pkItem); // [heap-use-after-free] // assuming that the previous branch gets executed, this could cause a crash, since you're trying to read from that deleted item if (pkItem->GetVnum() == KEY_LEVEL1_SUNGMAHEE && GetDungeonStep() == 1) And all of it could be changed to: void SmhTMap::OnSetItemMonster(LPCHARACTER pkChar, LPITEM pkItem, LPCHARACTER pkMonster) { if (!pkChar) return; if (!pkItem) return; if (!pkMonster) return; uint32_t itemVnum = pkItem->GetVnum(); ITEM_MANAGER::instance().RemoveItem(pkItem); if (itemVnum != KEY_LEVEL1_SUNGMAHEE || GetDungeonStep() != 1) return; if (GetSeal1()) { if (GetSeal1()->GetVID() == pkMonster->GetVID()) { char szNotice[512]; snprintf(szNotice, sizeof(szNotice), LC_TEXT("[Sung Mahi Tower] Break the seal with Sung Mahi's Sealstone!")); FChatMap f(szNotice, GetMapIndex()); GetMapSectree()->for_each(f); GetSeal1()->Dead(); SetSeal1(NULL); } } // [...] // add the rest of them } I'm following the same logic, didn't read the rest of it. Idk what this does or why it removes the item on each call, but I assume there's a reason since sr rankacito, the person with primary studies, made it this way. The level of delusion on some people is fucking unbelievable, istg.
  2. You can do it in battle.cpp. If you give it a search you'll find: if (pkAttacker->IsPC()) { switch (pkAttacker->GetJob()) { case JOB_WARRIOR: iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_WARRIOR)) / 100; break; case JOB_ASSASSIN: iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_ASSASSIN)) / 100; break; case JOB_SURA: iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_SURA)) / 100; break; case JOB_SHAMAN: iAtk -= (iAtk * pkVictim->GetPoint(POINT_RESIST_SHAMAN)) / 100; break; } } And you can either do a hard cap, like if (pkAttacker->IsPC()) { int32_t pvpRaceResistCap = 80; switch (pkAttacker->GetJob()) { case JOB_WARRIOR: iAtk -= (iAtk * min(pkVictim->GetPoint(POINT_RESIST_WARRIOR), pvpRaceResistCap)) / 100; break; case JOB_ASSASSIN: iAtk -= (iAtk * min(pkVictim->GetPoint(POINT_RESIST_ASSASSIN), pvpRaceResistCap)) / 100; break; case JOB_SURA: iAtk -= (iAtk * min(pkVictim->GetPoint(POINT_RESIST_SURA), pvpRaceResistCap)) / 100; break; case JOB_SHAMAN: iAtk -= (iAtk * min(pkVictim->GetPoint(POINT_RESIST_SHAMAN), pvpRaceResistCap)) / 100; break; } } Or something like they've done for the elements and pvm races, where the resistance scales at a different rate than it shows there. Basically, 100% resist bonus gives 80% real resistance, but it can go beyond 80%, in which case 110% resist will give you 88% real. if (pkAttacker->IsPC()) { int32_t pvpRaceResistPer100Pct = 80; switch (pkAttacker->GetJob()) { case JOB_WARRIOR: iAtk -= (iAtk * pvpRaceResistPer100Pct * pkVictim->GetPoint(POINT_RESIST_WARRIOR)) / 10000; break; case JOB_ASSASSIN: iAtk -= (iAtk * pvpRaceResistPer100Pct * pkVictim->GetPoint(POINT_RESIST_ASSASSIN)) / 10000; break; case JOB_SURA: iAtk -= (iAtk * pvpRaceResistPer100Pct * pkVictim->GetPoint(POINT_RESIST_SURA)) / 10000; break; case JOB_SHAMAN: iAtk -= (iAtk * pvpRaceResistPer100Pct * pkVictim->GetPoint(POINT_RESIST_SHAMAN)) / 10000; break; } } You can also combine the 2 of them, idk. Or maybe don't fucking give 10% bonus?? Give them something like 5-8% and call it a day
  3. No worries, man, I just mentioned the break because that's how it works on the "clean" source/proto. Everyone is free to modify to suit their needs and it's not like a few more iterations will make any difference in real life anyway. Anyhow, don't mind me, I was just bored
  4. Pretty good, but this shouldn't be in support, G. Also, you should break after you find your race, otherwise you'll loop over the rest for no reason(unless you have multiple races for the same mob). The performance part makes no difference in release, since the compiler is smart enough to optimize the fuck out of them, but it does a bit of a difference in debug. Here's some profiles(in debug, with optimizations disabled) for 10 million iterations: Exact copy/paste of your code with raceFlag(for both) = RACE_FLAG_ANIMAL(first match) : [BRANCHES] Execution x 10000000 took [29.618000] [ARRAY] Execution x 10000000 took [283.952606] Exact copy/paste of your code with raceFlag(for both) = RACE_FLAG_TREE(last match) [BRANCHES] Execution x 10000000 took [287.451385] [ARRAY] Execution x 10000000 took [345.841217] With raceFlag(for both) = RACE_FLAG_ANIMAL(first match) + break after match: [BRANCHES] Execution x 10000000 took [29.319500] [ARRAY] Execution x 10000000 took [47.762199] With raceFlag(for both) = RACE_FLAG_TREE(last match) + break after match(useless here): [BRANCHES] Execution x 10000000 took [295.321716] [ARRAY] Execution x 10000000 took [282.486206] With raceFlag(for both) = RACE_FLAG_ANIMAL(first match) + break after match + static array: [BRANCHES] Execution x 10000000 took [29.350700] [ARRAY] Execution x 10000000 took [32.444702] With raceFlag(for both) = RACE_FLAG_TREE(first match) + break after match(useless here) + static array: [BRANCHES] Execution x 10000000 took [298.241302] [ARRAY] Execution x 10000000 took [272.202393] Using a switch with raceFlag = RACE_FLAG_ANIMAL(first match) [BRANCHES] Execution x 10000000 took [31.487902] [ARRAY] Execution x 10000000 took [32.890202] [SWITCH] Execution x 10000000 took [31.182301] Using a switch with raceFlag = RACE_FLAG_TREE(last match). Something like RACE_FLAG_ATT_ELEC(which isn't checked) brings the switch down to 16ms. [BRANCHES] Execution x 10000000 took [289.458801] [ARRAY] Execution x 10000000 took [271.130280] [SWITCH] Execution x 10000000 took [46.620998] Yeah, I'm bored, how did you know? Take these with a grain of salt btw, the numbers are influenced by what's going on on my pc at the time of running the program, but I guess they're good for a quick "lemme have a look at this shit".
  5. [EDITED OUT] Corky will update his message, no point in writing the same thing twice. Will update the repository and the archive in a few min. Edit: Topic, repository and archive are up to date Edit2: In case it helps any of you. Speachless answered and said he can still get it to freeze in the very beginning, but it's because he's loading some things before the window is fully loaded, which means it's a custom problem that I will not handle for you. Not exactly a problem if you ask me, but his fix was to only enable the window moving part after the player logged in(should be fine if you enable it right before the game ::Loop() starts as well).
  6. Done, updated repo and the download link, thanks for reminding me!
  7. That's the default behavior for the app, you just didn't get the chance to see it yet. If you can't see that part of the screen, then it won't render it(hence the black part), and when you take it back, it'll start rendering it again(sometimes with a slight delay, which is why get the chance to see the black part for a few ms).
  8. Ok, thanks, I'll add a fix later tonight. As far as I know, most applications have a "fucking stop" type of deal when clicking the escape key. We'll see. Ah damn, yeah, it should be m_InitialMouseMovingPoint in CPythonApplication::UpdateMainWindowPosition(). I'll update it now, thanks Update: From what I see, you can manage to get it stuck in "drag mode" if you: start dragging in loading phase and, while it's loading, you drag your mouse out of the window and release really fast But as soon as the app is done processing it'll snap right under your mouse, and a simple click will just take it out of "drag mode", which is default behavior for most applications you're using today, so I don't see that as a problem. Waiting for Speachless to answer my DM and tell me exactly how to get it stuck with right click, because I tried 20 times and couldn't.
  9. That picture says that you're calling AddGuest on a null pointer, which is why you're getting the crash. Update: Ok, yeah, I think you're right(also using the TEMP_BUFFER is much better than ballparking the size of your buffers). Been too tired when writing this, don't mind my ass
  10. Topic updated, added full fix. I don't even know why I spent 6 hours reading docs and 100 forum pages from 2006 when I could've done this from the beginning, but whatever. Fuck you and I'll see you tomorrow Edit 1: Added checks for right click Edit 2: Proper function and variable names. GitHub and download links updated
  11. Thank you, Corky, but maybe next time ask why none of us, the plebs, ever came forward with that solution.
  12. No worries, feel free to do whatever you want with it. I just wanted to give you a heads up because most people just copy/paste the code without even reading/trying to understand what's going on and then come back crying that their shit breaks or isn't working properly(even if I explicitly said it's an experiment or a first version that should only be used as base). Hell yeah, if you have the time to look more into it and find some permanent(or better) fix, feel free to do so, that'd be great. Cheers! - Amun Edit: Came up with a permanent, stable fix. The previous answers no longer apply.
  13. That's just some experiment I fucked around with, but it doesn't fix all the ways one could freeze the client(read the comments) and I also consider it unstable(doesn't work at all with py3). Had no time to make an update, but anyway, I would avoid going live with it.
  14. Thanks for sharing, G. I needed it to show an item on a locked page of the offline shop. The example is just something I've put together quickly for the people that didn't know how to do it, or wanted some fast C&P to see if it works. None of you should take it as a "this is how it should be", feel free to edit it however you like(with different colors, maybe even show the item that goes there) and make it yours.
×
×
  • 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.