Beiträge von VegaS

    Rebuild the source client maybe the ScriptLib isn't was compiled with the last modifications and remaining the old one.
    Some people was had this problem with reading folder what contain uppercase:

    ChildLoop: AsyncSQL: query failed: Unknown column 'part_acce' in 'field list'

    C
    1. //@src/db/ClientManagerPlayer.cpp
    2. //Search for:
    3. "stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair,part_acce,"
    4. //Replace with:
    5. "stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair,"

    Already you get the point and how to do it.
    Now all what you have to do is just replace the minus value default with the one what you want for each bonus, there is just some bonus, not 1000.
    Search the value default for each one and do it, like these one:

    CSS
    1. self.GetChild("MSPD_Value").SetText("%d" % (max(0, player.GetStatus(player.MOVING_SPEED) - 100)))
    2. self.GetChild("ASPD_Value").SetText("%d" % (max(0, player.GetStatus(player.ATT_SPEED) - 100)))
    3. self.GetChild("CSPD_Value").SetText("%d" % (max(0, player.GetStatus(player.CASTING_SPEED) - 100)))

    That should be ok i think.

    Python
    1. """
    2. File: src/game/char.cpp
    3. &CHARACTER::ComputePoints()
    4. &SetPoint(POINT_MOV_SPEED, 100) // Default value
    5. &Total amount of movement speed = player.GetStatus(player.MOVING_SPEED).
    6. &Total amount -= STANDARD_SPEED(100) result only accumulated bonuses from equipment.
    7. """
    8. SetText("%d" % (max(0, player.GetStatus(player.MOVING_SPEED) - 100)))



    This script was killed by who did it.
    Please do not kill python, it's a nice language.


    PS: Didn't tested it.

    We don't need to add extra switch when already exist a boolean on instance class of item with these checks, CItem::CanUsedBy (Bitte melden Sie sich an, um diesen Link zu sehen.)


    So in this case just do this:


    C
    1. //Search for:
    2. if (item->CheckItemUseLevel(ch->GetLevel()) == true)
    3. //Replace with:
    4. if (item->CheckItemUseLevel(ch->GetLevel()) && item->CanUsedBy(ch))

    Have careful on tabs too, because you was change variables on out of function OnLogin

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

    That should be more clean on my opinion.

    Not need a loop to check every value of list because already is list. (I was tired when i do the release with affect potion)
    Should look like that maybe, but is really shit. (not do that)

    Python
    1. if type < 500 and not type in mainAffectPotion["affect"] and type <> chr.NEW_AFFECT_POLYMORPH:

    ______________________________________________________________________________________________________________
    To assigned the list affects exist more methods, use it what you want, this is just a ex. (here we speak about optimize, but in this case when have just some elements, isn't problem what method you used

    Python
    1. self.NEW_AFFECT_LIST = mainAffectPotion["affect"]
    2. self.NEW_AFFECT_LIST = mainAffectPotion["affect"][:]
    3. self.NEW_AFFECT_LIST = mainAffectPotion["affect"] * 1
    4. self.NEW_AFFECT_LIST = list(mainAffectPotion["affect"])
    5. self.NEW_AFFECT_LIST = copy.deepcopy(mainAffectPotion["affect"])
    6. self.NEW_AFFECT_LIST = eval(repr(mainAffectPotion["affect"]))
    7. self.NEW_AFFECT_LIST = [i for i in mainAffectPotion["affect"]]
    8. self.NEW_AFFECT_LIST.extend(mainAffectPotion["affect"])

    Do it like that:


    Zitat von Quadra1

    now the trigger work fine, but the column coins wont get updated in account.account


    Already ymir did the function for lua to charge the coins via pc.charge_cash, but not all people was used because name of row is called: "cash" and they are used on website/itemshop etc row "coins", but can change very easy.
    You don't need to use other mysql query command for that, when you already have that on source.
    Go in /src/db/ClientManager.cpp
    Search for:

    C
    1. sprintf(szQuery, "update account set `cash` = `cash` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);

    Replace `cash` = `cash` with `coins` = `coins`.

    If i would do it like that, it will return None if the first row is not with the given vnum :o

    "You can do it too, here is just a example."
    I not say to delete the loop, i just showed a better option to return on situation because you did return color, return None etc, isn't compatible on this case my example from quoute of course with your loop


    Python
    1. if itemVnum >= fromVnum and itemVnum <= toVnum:
    2. return color
    3. return None

    I say you can do it simple like this: (I'm speaking just about returning mode

    Python
    1. return color if itemVnum is (itemVnum >= fromVnum and itemVnum <= toVnum) else None
    Zitat von Sanii

    I want to know if theres a better way to check if it is existing in the array.

    I can give you a better option for a dict elements and you can play with this more funny

    Python
    1. def Lookup(conjugateDict, *kwargs):
    2. endOfChain = conjugateDict
    3. for keyData in kwargs:
    4. if isinstance(endOfChain, dict) and keyData in endOfChain:
    5. endOfChain = endOfChain[keyData]
    6. else:
    7. return None
    8. return endOfChain
    Zitat von Sanii

    And maybe i could do: if itemVnum in range(fromVnum, toVnum+1): but i dont like this +1 xD

    Python
    1. import numpy
    2. if (numpy.any((fromVnum <= itemVnum) & (itemVnum <= toVnum))):

    I hope you get my points, i just speaking about more good practices, on progamming never exist a final version of code, everytime we can extended it.
    Good luck.

    Try that and have careful to have the function get_level_dif on source added.

    Python
    1. def GetItemTitleColor(itemVnum):
    2. for fromVnum, toVnum, color in COLORED_ITEMS:
    3. if itemVnum >= fromVnum and itemVnum <= toVnum:
    4. return color
    5. return None

    You can do it too, here is just a example.

    Python
    1. return color if itemVnum is (itemVnum >= fromVnum and itemVnum <= toVnum) else None
    CSS
    1. for (int i = 0; i < CItemData::ITEM_SHINING_MAX_COUNT; i++)
    2. {
    3. // ..................
    4. m_weaponShiningEffects[0][i] = 0;
    5. m_weaponShiningEffects[1][i] = 0;
    6. }


    The idea isn't so bad, but some things isn't too good, like this one.
    When you can use memset (is useful for intializing a section of memory to some value), without a loop for nothing.

    CSS
    1. memset(m_weaponShiningEffects, 0, sizeof(m_weaponShiningEffects));
    Python
    1. def LoadEffectTable():
    2. for effect in EffectTable:
    3. for i in range(len(EffectTable[effect])):
    4. vnum = effect
    5. effectpath = EffectTable[effect][i]
    6. Shining.Add(vnum, effectpath)


    Should look like this, without killing python.

    Python
    1. def LoadEffectTable():
    2. [Shining.Add(vnum, effectPath.pop(0)) for vnum, effectPath in EffectTable.iteritems()]

    0630 17:19:28578 :: AttributeError
    0630 17:19:28578 :: :
    0630 17:19:28578 :: 'NoneType' object has no attribute 'UpdateRect'


    Search for:

    Python
    1. self.editLine.UpdateRect()
    2. self.editSlot.UpdateRect()
    3. self.board.UpdateRect()

    Replace with this:

    Python
    1. for questObjects in (self.editLine, self.editSlot, self.board):
    2. if questObjects:
    3. questObjects.UpdateRect()

    First one thanks for release again girl, here is a small part for c++ (isn't so beautiful but should working fine, i didn't tested, is a example for who want to do via source and not with quests).
    About to check the type victim killed doesn't have sense in this case because:

    • Type 0 = Monster
    • Type 1 = NPC
    • Type 2 = Stone
    • [....]

    Is enough to check if the killed victim isn't a player.


    Isn't good this check for what you need, and do a loop for that thing to request a packet reloaded just one time for each login is really bad.
    Should look more simple like this:



    Uhm anyway looks ugly this method because will apply for each login every time, you should do a check if he is privileged or not.