Honorable Member Owsap 8166 Posted January 8, 2020 Honorable Member Share Posted January 8, 2020 (edited) M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) This is the hidden content, please Sign In or Sign Up ( GitHub ) Hello, came by to share something simple yet helpful for players, someone requested me this feature that allows you to input money with k format on the pick money dialog window, this will enable you to input “1kk” instead of “1000000” Hope it comes in handy for who is planning to use it. Spoiler Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 126 1 1 1 1 1 3 1 27 4 73 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
Active Member hachiwari 138 Posted January 8, 2020 Active Member Share Posted January 8, 2020 why did you write such an ugly FormatMoneyToK method? :< anyway, nice idea 1 Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8166 Posted January 8, 2020 Author Honorable Member Share Posted January 8, 2020 1 minute ago, hachiwari said: why did you write such an ugly FormatMoneyToK method? :< What's your method? https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
numNum 37 Posted January 8, 2020 Share Posted January 8, 2020 nice release hmm is it possible to make "pick money dialog" separated by dots ? ex: 850.000.000 i think it would be good Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19674 Posted January 8, 2020 Honorable Member Share Posted January 8, 2020 Good idea, not the best solution. Thanks anyway. 1 Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8166 Posted January 8, 2020 Author Honorable Member Share Posted January 8, 2020 14 minutes ago, jeddawee said: nice release hmm is it possible to make "pick money dialog" separated by dots ? ex: 850.000.000 i think it would be good @jeddawee @ uiPickMoney.py # Search str(maxValue)) # Replace with str(localeInfo.NumberToMoneyString(maxValue))) 1 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
numNum 37 Posted January 8, 2020 Share Posted January 8, 2020 (edited) 4 minutes ago, Owsap said: uiPickMoney.py # Search str(maxValue)) # Replace with str(localeInfo.NumberToMoneyString(maxValue))) sorry but i meant this one , the black box Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8166 Posted January 8, 2020 Author Honorable Member Share Posted January 8, 2020 (edited) 39 minutes ago, jeddawee said: sorry but i meant this one , the black box @jeddawee Just use localeInfo.NumberToMoneyString uiExchange.py # Search self.OwnerMoney.SetText(str(exchange.GetElkFromSelf())) self.TargetMoney.SetText(str(exchange.GetElkFromTarget())) # Replace with self.OwnerMoney.SetText(localeInfo.NumberToMoneyString(exchange.GetElkFromSelf())) self.TargetMoney.SetText(localeInfo.NumberToMoneyString(exchange.GetElkFromTarget())) Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 1 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted January 9, 2020 Premium Share Posted January 9, 2020 Nice idea, good job. "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
SorinSmon 494 Posted January 9, 2020 Share Posted January 9, 2020 yep good idea sir! xD Link to comment Share on other sites More sharing options...
HITRON 694 Posted January 9, 2020 Share Posted January 9, 2020 Better: USE_MONEY_K_FORMAT = True if USE_MONEY_K_FORMAT: def FormatMoneyToK(string): moneyString = str(string) moneyString = moneyString.replace("K","k") money = 0 if len(moneyString) > 1 and 'k' in moneyString: money = int(moneyString.replace('k', '000')) return money 1 Link to comment Share on other sites More sharing options...
Honorable Member Mali 41830 Posted January 9, 2020 Honorable Member Share Posted January 9, 2020 3 hours ago, HITRON said: Better: USE_MONEY_K_FORMAT = True if USE_MONEY_K_FORMAT: def FormatMoneyToK(string): moneyString = str(string) moneyString = moneyString.replace("K","k") money = 0 if len(moneyString) > 1 and 'k' in moneyString: money = int(moneyString.replace('k', '000')) return money you can use lower instead of replace moneyString.lower() 1 1 Link to comment Share on other sites More sharing options...
HITRON 694 Posted January 9, 2020 Share Posted January 9, 2020 47 minutes ago, Mali61 said: you can use lower instead of replace moneyString.lower() I followed his example with the replace bellow just to be understandable. Yes you can. Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10270 Posted January 9, 2020 Forum Moderator Share Posted January 9, 2020 (edited) On 1/8/2020 at 10:34 PM, Owsap said: if USE_MONEY_K_FORMAT: def FormatMoneyToK(string): moneyString = str(string) money = 0 if len(moneyString) > 1: if 'k' in moneyString: money = int(moneyString.replace('k', '000')) elif 'K' in moneyString: money = int(moneyString.replace('K', '000')) return money The idea is good, but the code is bugged and unreadable, here're the bugs: text = '1kks' ValueError: invalid literal for int() with base 10: '1000000s' text = '1kk500' 1000000500 text = '1abcd' '1abcd' If I'm the one who do this, i would do it more extendable and using a proficient way. This is the hidden content, please Sign In or Sign Up At least, keep the copyright. Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 67 1 1 1 1 1 16 2 57 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19674 Posted January 10, 2020 Honorable Member Share Posted January 10, 2020 This why I said not the best solution. I would tell to the IME let me input key chars near the numbers. Aka SetNumberMode2 1 Link to comment Share on other sites More sharing options...
SorinSmon 494 Posted January 10, 2020 Share Posted January 10, 2020 hmm.. i like to see my idea start to have so many different methods of implementation... Thanks all for doing this! respect. Another idea for you guys xD and this can be a little complicated i think "The storage can now be opened without the password. In addition, it will not close automatically as soon as you run a bit." Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8166 Posted January 10, 2020 Author Honorable Member Share Posted January 10, 2020 @VegaS™ I was aware that It was not the best method neither the best code, although it never went trough my mind to try the bugs you mentioned, since it did what it supposed to I stopped there but it was my fault to not try possible erros. Thanks for sharing your correction and making the feature better, also wanna thank everyone that gave their feedback on the same. 2 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
HITRON 694 Posted January 10, 2020 Share Posted January 10, 2020 @VegaS™ But if you want to add like 1.200.000.000, would be nice if you could use 1.2kkk example or 1.2b. Link to comment Share on other sites More sharing options...
Leafxc 1 Posted April 19, 2020 Share Posted April 19, 2020 (edited) Sorry to bring this one up. But i'm fairly new to scripts (python). Can someone explain me this? Quote 0419 10:51:22482 :: Traceback (most recent call last): 0419 10:51:22482 :: File "ui.py", line 1363, in CallEvent 0419 10:51:22482 :: File "ui.py", line 88, in __call__ 0419 10:51:22482 :: File "ui.py", line 70, in __call__ 0419 10:51:22482 :: File "uiPickMoney.py", line 102, in OnAccept 0419 10:51:22482 :: AttributeError 0419 10:51:22482 :: : 0419 10:51:22482 :: 'module' object has no attribute '_PickMoneyDialog__ConvertMoneyText' 0419 10:51:22482 :: I tried to follow his tutorial but..i didn't could reproduce / follow one step of him. Quote ''' 2. ENABLE_CHEQUE_SYSTEM ''' # Search @ def OnAccept money_text = self.pickValueEditLine.GetText() # Add below if constInfo.USE_KMB_MONEY_FORMAT: if money_text: moneyValue = min(constInfo.__ConvertMoneyText(text), self.maxValue) if moneyValue: if self.eventAccept: self.eventAccept(moneyValue) Sorry fixed the Problem myself Edited April 19, 2020 by Leafxc Link to comment Share on other sites More sharing options...
xGetHigh 140 Posted May 9, 2020 Share Posted May 9, 2020 On 4/19/2020 at 11:56 AM, Leafxc said: Sorry to bring this one up. But i'm fairly new to scripts (python). Can someone explain me this? I tried to follow his tutorial but..i didn't could reproduce / follow one step of him. Sorry fixed the Problem myself I have the same problem. 'module' object has no attribute '_PickMoneyDialog__ConvertMoneyText' Can you tell me how to solve it? BTW The "system" is interesting Link to comment Share on other sites More sharing options...
SorinSmon 494 Posted May 14, 2020 Share Posted May 14, 2020 same problem.. Link to comment Share on other sites More sharing options...
Itachi 44 Posted May 16, 2020 Share Posted May 16, 2020 On 5/9/2020 at 3:30 PM, xGetHigh said: I have the same problem. 'module' object has no attribute '_PickMoneyDialog__ConvertMoneyText' 'module' object has no attribute '_PickMoneyDialog__ConvertMoneyText' Can you tell me how to solve it? BTW The "system" is interesting uipickmoney.py search: moneyValue = min(constInfo.__ConvertMoneyText(text), self.maxValue) replace moneyValue = min(constInfo.ConvertMoneyText(text), self.maxValue) open constinfo.py search: def ConvertMoneyText(self, text, powers = dict(k = 10**3, m = 10**6, b = 10**9)): replace: def ConvertMoneyText(text, powers = dict(k = 10**3, m = 10**6, b = 10**9)): add: import re problems solved 1 2 Link to comment Share on other sites More sharing options...
SorinSmon 494 Posted May 16, 2020 Share Posted May 16, 2020 working! gg man Link to comment Share on other sites More sharing options...
Premium ‚Point‘ 20 Posted November 29, 2022 Premium Share Posted November 29, 2022 (edited) Thanks for the release @ VegaS™ and @ Owsap - working like a charm! Maybe one of you could help to handle a point/comma aswell? I tried by my self but im not really into regex Thanks in advance & Best Regards Edited November 29, 2022 by ‚Point‘ Link to comment Share on other sites More sharing options...
Active+ Member m2Ciaran 388 Posted December 1, 2022 Active+ Member Share Posted December 1, 2022 On 11/29/2022 at 1:39 PM, ‚Point‘ said: Thanks for the release @ VegaS™ and @ Owsap - working like a charm! Maybe one of you could help to handle a point/comma aswell? I tried by my self but im not really into regex Thanks in advance & Best Regards Its from old copy but might work can't test it rn take a look def value_to_float(self, x): if type(x) == float or type(x) == int: return x result = 1 while 'K' in x: a = int(x.find('K')) x = x[0 : a : ] + x[a + 1 : : ] result = result * 1000 return float(x) * result def OnAccept(self): allowed = "0123456789kK." text = self.pickValueEditLine.GetText() if len(text) > 0 and text.isdigit(): money = long(text) money = min(money, self.maxValue) if money > 0: if self.eventAccept: self.eventAccept(money) elif len(text) > 0 and text.isdigit() == False: TXT = text TXT = TXT.replace('k', 'K') TXT = TXT.replace(',', '.') ct = True nG = -1 pG = -1 lG = -1 for i in range(0, len(TXT)): if allowed.find(TXT[i]) == -1 and allowed.find(TXT[i].upper()) == -1: ct = False break if (TXT.count('.') > 1) or (TXT.find('.') > TXT.find('K') and TXT.find('K') != -1 and TXT.find('.') != -1): ct = False if ct == True: money = int(self.value_to_float(TXT)) if money > 0: if self.eventAccept: self.eventAccept(money) self.Close() Link to comment Share on other sites More sharing options...
Recommended Posts