Jump to content

Recommended Posts

  • Active Member

A while ago I had to code this in a short amount of time, and since I didn’t have much time, I made it using the simplest method.

char_battle.cpp

inside:

bool CHARACTER::Damage

before:

        if (pAttacker)
            SendDamagePacket(pAttacker, dam, damageFlag);

add:

        std::map<int, int> damageLimits = {
            {8009, 25000},
            {8010, 30000},
            {8011, 35000},
            {8012, 40000},
            {8013, 45000},
            {8014, 50000},
            {8024, 55000},
            {8025, 60000},
            {8026, 70000},
            {8027, 100000},
            {8127, 100000},
            {8158, 100000}
        };

        auto it = damageLimits.find(GetRaceNum());
        if (it != damageLimits.end() && dam > it->second) {
            dam = it->second;
        }

client part:
uitarget.py

search:

    GRADE_NAME =    {
                        nonplayer.PAWN : localeInfo.TARGET_LEVEL_PAWN,
                        nonplayer.S_PAWN : localeInfo.TARGET_LEVEL_S_PAWN,
                        nonplayer.KNIGHT : localeInfo.TARGET_LEVEL_KNIGHT,
                        nonplayer.S_KNIGHT : localeInfo.TARGET_LEVEL_S_KNIGHT,
                        nonplayer.BOSS : localeInfo.TARGET_LEVEL_BOSS,
                        nonplayer.KING : localeInfo.TARGET_LEVEL_KING,
                    }

add:

    LIMITE_NIVEL = {
        8009: "25000",
        8010: "30000",
        8011: "35000",
        8012: "40000",
        8013: "45000",
        8014: "50000",
        8024: "55000",
        8025: "60000",
        8026: "70000",
        8027: "100000",
        8127: "100000",
        8158: "100000",
    }

inside:

 def __init__(self):

search:

closeButton = ui.Button()

add before:

        damageLimitText = ui.TextLine()
        damageLimitText.SetParent(self)
        damageLimitText.SetOutline()
        damageLimitText.SetHorizontalAlignRight()
        damageLimitText.Hide()
        self.damageLimitText = damageLimitText

after whole function:

    def __ShowMainCharacterMenu(self):

add:

   def ShowDamageLimitText(self, vid):
        vnum = nonplayer.GetRaceNumByVID(vid)

        if vnum in self.LIMITE_NIVEL:
            limita_damage = self.LIMITE_NIVEL[vnum]
            self.damageLimitText.SetText("Limita damage este: " + str(limita_damage))
        else:
            self.damageLimitText.SetText("Nu exista limita de damage pentru acest metin.")

        self.damageLimitText.Show()

replace:

    def UpdatePosition(self):

with:

    def UpdatePosition(self):
        self.SetPosition(wndMgr.GetScreenWidth() / 2 - self.GetWidth() / 2, 10)
        if chr.GetInstanceType(self.vid) == chr.INSTANCE_TYPE_STONE:
            self.SetSize(self.GetWidth(), self.GetHeight() + 20)

            self.ShowDamageLimitText(self.vid)

            self.damageLimitText.SetPosition(self.GetWidth() / 2, 30)
            self.damageLimitText.Show()

        else:
            self.damageLimitText.Hide()

 

  • Metin2 Dev 1
  • Good 1
  • Love 1
Link to comment
https://metin2.dev/topic/34164-c-py-simple-damage-limit/
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.