Jump to content

VegaS™

Forum Moderator
  • Posts

    656
  • Joined

  • Last visited

  • Days Won

    187
  • Feedback

    100%

Everything posted by VegaS™

  1. That's the correct way. int affect_stun(lua_State * L) { const uint32_t lDuration = 30; // seconds const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (ch) ch->AddAffect(AFFECT_STUN, POINT_NONE, 0, AFF_STUN, lDuration, 0, true); return 0; }
  2. @Syriza Check my reply again, i forgot the directory 'user/credentials'.
  3. Something I wrote in a hurry. introLogin.py (add it to the end of the lines) [Hidden Content]
  4. I can't read your file because atm i'm at phone, you're not using the same minor version of python interpreter, the pyc (compiled bytecode) module was compiled for example 2.7 vs. 2.2, but this can't be the real problem since you don't get Bad magic number. So i assume your problem is with the sequence (sequence of the elements to be joined) from join method. Basically there's a list comprehensions, list comprehensions provide a concise way to create lists. new_list = [] for item in old_list: new_list.append(item) You can obtain the same thing using list comprehension: new_list = [item for item in old_list] The list comprehension always returns a result list. # Now return ''.join(random.choice(letters) for i in range(length)) # After return ''.join([random.choice(letters) for i in range(length)]) That's because python22 isn't so smart. (18 years ago)
  5. Did you tried to add imports at begin of file < introLogin.py? import random, string
  6. Ok, there're many guys which want that and wroted me in PM, i'll leave the code here. root/uiInventory.py locale/en/ui/InventoryWindow.py
  7. ../Srcs/Client/UserInterface/PythonItemModule.cpp
  8. Already i posted that in another forum some years ago, but i can't share the link here, check your inbox.
  9. If you want to do it like @Alphax Wolf, you can do 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. UPDATE player.item_proto SET name = vnum WHERE vnum IN (SELECT drop_item FROM player.mob_proto WHERE drop_item > 0); # Affected rows: 83 # Time: 35.919ms And if you want to see what monsters are using etc_drop_item, there's a ex select query. SELECT DISTINCT drop_item FROM player.mob_proto where drop_item > 0; Btw, i would change the structure of reading the file instead of doing this, here's a hint.
  10. 2019-04-16 14:54:48 Tuesday (Video - Click) - 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 INT value 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 ItemAwardManager.cpp (Click). C++11 or higher is required for checking attributes.
  11. onPressKeyDict[app.DIK_F5] = lambda : self.GetItemData() import player, dbg def GetItemData(self): slotIndex = 0 # Slot index (position) window_type = player.INVENTORY # INVENTORY, SAFEBOX, MALL, DRAGON_SOUL_INVENTORY, BELT_INVENTORY ... itemVnum = player.GetItemIndex(window_type, slotIndex) if not itemVnum: return metinSlot = [player.GetItemMetinSocket(window_type, slotIndex, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)] attrSlot = [player.GetItemAttribute(window_type, slotIndex, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)] dbg.TraceError("slotIndex({}), window_type({}), itemVNum({})".format(slotIndex, window_type, itemVnum)) dbg.TraceError("metinSlot: {}".format(metinSlot)) dbg.TraceError("attrSlot: {}".format(attrSlot)) >>> 0419 16:37:40825 :: slotIndex(0), window_type(1), itemVNum(12019) >>> 0419 16:37:40825 :: metinSlot: [28442, 28441, 28438] >>> 0419 16:37:40825 :: attrSlot: [(1, 2000), (29, 15), (30, 15), (31, 15), (32, 15), (0, 0), (0, 0)]
  12. (2.5) Questions & Answers specific rules Don't modify your thread (or reply to it) to mark it solved, and not explain the solution to the issue. Please use our tag system and vote good/bad answers so everyone can clearly see what matters!
  13. You should replace the condition in function OnUpdate: #if 0 != self.targetName: if self.targetName and self.chatLine:
  14. M2 Download Center Download Here ( Internal ) Download Here ( GitHub ) 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: TraceError("str", 1, 4.0, (31, 22), [100, 200], True) Tracef("str", 1, 4.0, (31, 22), [100, 200], True) LogBox("str", 1, 4.0, (31, 22), [100, 200], True) sys_err("str", 1, 4.0, (31, 22), [100, 200], True) # No import needed, is a built-in function, you can call it everywhere. # The function sys_err or TraceError doing the same thing. # 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: import dbg dbg.TraceError("just_one_string_allowed") dbg.Tracef("just_one_string_allowed") dbg.LogBox("just_one_string_allowed") # Need to import the module dbg every time in every file where you want to use it. # 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 : sys_err('warning', 'error', 'unknown') << 415 17:8:1130 :: warning << 415 17:8:1130 :: error << 415 17:8:1130 :: unknown sys_err(100/2==50, 'set value to {}'.format(25)) << 415 17:6:1083 :: True << 415 17:6:1083 :: set value to 25 sys_err([45, 100], (200, 1500, 32), 42.8, 500, "donald-trump", False) << 415 17:8:1094 :: [45, 100] << 415 17:8:1094 :: (200, 1500, 32) << 415 17:8:1094 :: 42.8 << 415 17:8:1094 :: 500 << 415 17:8:1094 :: donald-trump << 415 17:8:1094 :: False sys_err("what-you-want") << 415 17:8:1072 :: what-you-want GitHub repository: [Hidden Content]
  15. Even if he wanted to change the bonus type, you still need how calculation works, you'll add Att Monster instead of Max HP and at Perfect Master, the value will be 1.862? So he still need the calculations, before doing this, also for change the type of bonus isn't so easy, at least you need to know some things. The current party bonuses are saved just as a point-value, not as a real bonus, the real bonus is calculated from another parts. PARTY_ROLE_SKILL_MASTER > POINT_PARTY_SKILL_MASTER_BONUS case POINT_MAX_SP: { SetPoint(type, GetPoint(type) + amount); const int iRealPointSP = GetRealPoint(POINT_MAX_SP); int iAddSP = MIN(800, iRealPointSP * GetPoint(POINT_MAX_SP_PCT) / 100); iAddSP += GetPoint(POINT_MAX_SP); // Add SP to current value by party skill bonus iAddSP += GetPoint(POINT_PARTY_SKILL_MASTER_BONUS); SetMaxSP(iRealPointSP + iAddSP); val = GetMaxSP(); } break; POINT_PARTY_ATTACKER_BONUS POINT_PARTY_TANKER_BONUS POINT_PARTY_BUFFER_BONUS POINT_PARTY_SKILL_MASTER_BONUS POINT_PARTY_HASTE_BONUS POINT_PARTY_DEFENDER_BONUS So if you want to change the bonuses, you've to rewrite all the calculations from those functions (remove the lines += GetPoint(..), and make them static, depends of you how and where, you can add it inside party.cpp after ComputePoints of each bonus like. // Set as melee ch->PointChange(POINT_ATTBONUS_MONSTER, ch->GetPoint(POINT_PARTY_BUFFER_BONUS));
  16. Srcs/Server/game/src/party.cpp float k = (float) ch->GetSkillPowerByLevel( MIN(SKILL_MAX_LEVEL, m_iLeadership ) ) / 100.0f; // PARTY_ROLE_ATTACKER int iBonus = (int) (10 + 60 * k); // PARTY_ROLE_TANKER int iBonus = (int) (50 + 1450 * k); // PARTY_ROLE_BUFFER int iBonus = (int) (5 + 45 * k); // PARTY_ROLE_SKILL_MASTER int iBonus = (int) (25 + 600 * k); // PARTY_ROLE_HASTE int iBonus = (int) (1+5*k); // PARTY_ROLE_DEFENDER int iBonus = (int) (5+30*k); float k = (float) ch->GetSkillPowerByLevel( MIN(SKILL_MAX_LEVEL, m_iLeadership ) ) / 100.0f; m_iLeadership = Leader skill ship skill level which is increased by (book vnum: 50301, 50302, 50303) int CHARACTER::GetSkillPowerByLevel(int level, bool bMob) const { return CTableBySkill::instance().GetSkillPowerByLevelFromType(GetJob(), GetSkillGroup(), MINMAX(0, level, SKILL_MAX_LEVEL), bMob); } int CTableBySkill::GetSkillPowerByLevelFromType(int job, int skillgroup, int skilllevel, bool bMob) const { if (bMob) return m_aiSkillPowerByLevelFromType[0][skilllevel]; if (job >= JOB_MAX_NUM || skillgroup == 0) return 0; int idx = (job * 2) + (skillgroup - 1); return m_aiSkillPowerByLevelFromType[idx][skilllevel]; } Let's take a example, a warrior, skill group 1. idx = 0 * 2 + 1 - 1 = 0 skilllevel = m_iLeadership m_iLeadership = 40 (Skill Perfect Master) // 0 5 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 50 52 54 56 58 60 63 66 69 72 82 85 88 91 94 98 102 106 110 115 125 125 125 125 125 m_aiSkillPowerByLevelFromType[0][40] = 125 PARTY_ROLE_DEFENDER: (5+30*k) k = 125 / 100 = 1.25 iBonus = 5 + 30 * 1.25 = 42.5 (converted to integer will be 42) Output from skill P: // PARTY_ROLE_ATTACKER - Set as attacker 10 + 60 * (125 / 100) = 85 // PARTY_ROLE_TANKER - Set as berserker 1 + 5 * (125 / 100) = 7.25 = 7 // PARTY_ROLE_BUFFER - Set as melee 50 + 1450 * (125 / 100) = 1862.5 = 1862 // PARTY_ROLE_SKILL_MASTER - Set as blocker 5 + 45 * (125 / 100) = 61.25 = 61 // PARTY_ROLE_HASTE - Set as defender 5 + 30 * (125 / 100) = 42.5 = 42 // PARTY_ROLE_DEFENDER - Set as wizzard 25 + 600 * (125 / 100) = 775 Is a fast explanation, i hope you understand it.
  17. Thanks to @ProfessorEnte for reports. 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. # Random book INSERT INTO player.item_award(`login`, `vnum`, `count`, `mall`) VALUES ('account', 50300, 1, 1); # Specific book by skill vnum INSERT INTO player.item_award(`login`, `vnum`, `count`, `socket0`, `mall`) VALUES ('account', 50300, 1, 4, 1);
  18. M2 Download Center Download Here ( Internal ) Download Here ( GitHub ) Metin2 Extended Item Award You can store all bonuses and stones for items. I wrote that as request from @ProfessorEnte, more informations at repository. 2018-04-02 14:02:11 Monday Fixed problem with save bonus after reload items. Fixed problem with unknown values. Correction for socket real time and more. Fixed unknown average/skill damage bonus value. player.item_proto.addon_type = -1 (Eg. 189, 199, 299, 1139, 1179, 2159, 2179, 3169, 3219, 5119, 5129, 6019, 6069, 6079, 7169)[+0 - +9] That's for the items which have addon type (-1) and you added them in item shop without bonuses like skill damage or hit damage, value x, y as default, so they'll will be without bonuses and get bugged. Now when the item will be inserted there'll be a check if item doesn't have those bonuses (from query) add a random average/skill damage bonus value. INSERT INTO player.item_award(`login`, `vnum`, `count`, `mall`) VALUES ('account', 189, 1, 1); 2019-04-12 02:31:18 Friday 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. # Random book INSERT INTO player.item_award(`login`, `vnum`, `count`, `mall`) VALUES ('account', 50300, 1, 1); # Specific book by skill vnum INSERT INTO player.item_award(`login`, `vnum`, `count`, `socket0`, `mall`) VALUES ('account', 50300, 1, 4, 1); 2019-04-16 14:54:48 Tuesday (Video - Click) 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 ItemAwardManager.cpp. C++11 or higher is required for checking attributes. # Test unknown types + higher and lower values in game. INSERT INTO `player`.`item_award`(`login`, `vnum`, `count`, `attrtype0`, `attrvalue0`, `attrtype1`, `attrvalue1`, `attrtype2`, `attrvalue2`, `attrtype3`, `attrvalue3`, `attrtype4`, `attrvalue4`, `mall`) VALUES ( 'test', 149, 1, 17, 25, -- ATTBONUS_HUMAN 22, 35, -- ATTBONUS_DEVIL, 32, 175, -- RESIST_BELL 33, -150, -- RESIST_FAN 48, 1, -- IMMUNE_STUN 1 ); # See the min-max values for all the bonuses from weapon. SELECT apply+0 AS `index`, apply AS `name`, lv1 as `min_value`, lv5 as `max_value` FROM `item_attr` WHERE weapon > 0; # See if a specific bonus is included in bonuses of weapon. SELECT apply, apply+0 FROM `item_attr` WHERE weapon > 0 AND apply in ('ATTBONUS_HUMAN', 'ATTBONUS_DEVIL', 'RESIST_BELL', 'RESIST_FAN', 'IMMUNE_STUN'); 2019-10-30 03:48:12 Wednesday Fixed expression is not assignable. Break a for loop after the bonus has found. Sockets & attrs INSERT INTO `player`.`item_award`(`login`, `vnum`, `count`, `given_time`, `why`, `socket0`, `socket1`, `socket2`, `attrtype0`, `attrvalue0`, `attrtype1`, `attrvalue1`, `attrtype2`, `attrvalue2`, `attrtype3`, `attrvalue3`, `attrtype4`, `attrvalue4`, `mall`) VALUES ( 'test', -- ACCOUNT_NAME 12029, -- ITEM_VNUM 1, -- ITEM_COUNT '2018-03-25 05:53:17', -- GIVEN_TIME 'ITEM_SHOP', -- REASON 28442, 28441, 28438, -- SOCKET 1 & 2 & 3 1, 1500, -- APPLY_MAX_HP 29, 10, -- APPLY_RESIST_SWORD, 30, 10, -- APPLY_RESIST_TWOHAND 31, 10, -- APPLY_RESIST_DAGGER 32, 10, -- APPLY_RESIST_BELL 1 -- MALL ); For those who use @martysama0134 source: //@Srcs/Server/db/src/ClientManager.cpp #define ENABLE_ITEMAWARD_REFRESH // Should be enabled Github repository or download - (click here): [hide][Hidden Content]]
  19. You should check the repository, already is before your comment. Update: - removed count method + added support for c++11
  20. M2 Download Center Download Here ( Internal ) Download Here ( GitHub ) Some months ago a user asked here how to do it. Github repository: [Hidden Content]
  21. Src/Server/game/src/cmd_general.cpp ACMD(do_cmd) { [...] if (ch->IsHack(false, true, nExitLimitTime) && ...) { [...] } [...] } Src/Server/game/src/char.cpp bool CHARACTER::IsHack(bool bSendMsg, bool bCheckShopOwner, int limittime) { [...] //PREVENT_PORTAL_AFTER_EXCHANGE if (iPulse - GetExchangeTime() < PASSES_PER_SEC(limittime)) { if (bSendMsg) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("거래 후 %d초 이내에는 다른지역으로 이동 할 수 없습니다."), limittime ); return true; } //END_PREVENT_PORTAL_AFTER_EXCHANGE [...] }
  22. Src/Server/game/src/char_battle.cpp struct FuncAggregateMonster { [.....] if (number(1, 100) <= 50) // 50% chance for pulling if (DISTANCE_APPROX(ch->GetX() - m_ch->GetX(), ch->GetY() - m_ch->GetY()) < 5000) // approximate distance 5000 if (ch->CanBeginFight()) ch->BeginFight(m_ch); [.....] };
×
×
  • 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.