Agora Metin2 1
Agora Metin2
Bvural41 1
Bvural41
romegames 1
romegames
noisiv 1
noisiv
Manwe Work 1
Manwe Work
Best Studio 1
Best Studio
kralhakan2009 1
kralhakan2009
Vahsi Uzman 1
Vahsi Uzman
InfernoShade 1
InfernoShade
Hikaye Ekle
Reklam vermek için turkmmo@gmail.com

Ticarette yazmalı yang sistemi

  • Konuyu başlatan Konuyu başlatan Agora Metin2
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 16
  • Görüntüleme Görüntüleme 3K

ROHAN2 WORLD 1-120 TR TİPİ OFFICIAL YOHARA, BALATHOR VE AMON! 80. GÜNÜNDE! +10.000 ONLİNE! HİLE VE BOT %100 ENGELLİ HEMEN TIKLA!

final haftamdayım serverıda uzun zamandır açmıyorum basit şeyler paylaştım zaten :(
Sizi anliyorum yanlız bölüm kurallari gereğince çalıştığına dair görsel eklenmesi gerek
 
Teşekkürler
 
Python:
USE_MONEY_T_FORMAT = True

if USE_MONEY_T_FORMAT:
def FormatMoneyToK(string):
moneyString = str(string)
money = 0

if len(moneyString) > 1:
if 't' in moneyString:
money = int(moneyString.replace('t', '000000'))
elif 'T' in moneyString:
money = int(moneyString.replace('T', '000000'))

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.



8f9d06c2fcb7f4525c2fe219a878a09d.png
4807153bd1bb3f4e9e4b00f492054864.png

9197a657a56afcab56b8b17ce77806e1.png
2be07686886205e82d437108f547bbbd.png


Python:
import re

    def __ConvertMoneyText(self, text, powers=dict(k=10**3, m=10**6, b=10**9)):
        """
        Format string value in thousands, millions or billions.

        '1k' = 1.000
        '100kk' = 100.000.000
        '100m' = 100.000.000
        '1b' = 1.000.000.000
        '1kmb' = 1.000 (can't use multiple suffixes types)

        :param text: string
        :return: int
        :date: 10.01.2020
        :author: Vegas
        """

        match = re.search(r'(\d+)({:s}+)?'.format('+|'.join(powers.keys())), text, re.I)
        if match:
            moneyValue, suffixName = match.groups()
            moneyValue = int(moneyValue)
            if not suffixName:
                return moneyValue

            return moneyValue * (powers[suffixName[0]] ** len(suffixName))

        return 0

    def OnAccept(self):
        text = self.pickValueEditLine.GetText()
        if text:
            moneyValue = min(self.__ConvertMoneyText(text), self.maxValue)
            if moneyValue:
                if self.eventAccept:
                    self.eventAccept(moneyValue)

        self.Close()
 
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.



8f9d06c2fcb7f4525c2fe219a878a09d.png
4807153bd1bb3f4e9e4b00f492054864.png

9197a657a56afcab56b8b17ce77806e1.png
2be07686886205e82d437108f547bbbd.png


Python:
import re

    def __ConvertMoneyText(self, text, powers=dict(k=10**3, m=10**6, b=10**9)):
        """
        Format string value in thousands, millions or billions.

        '1k' = 1.000
        '100kk' = 100.000.000
        '100m' = 100.000.000
        '1b' = 1.000.000.000
        '1kmb' = 1.000 (can't use multiple suffixes types)

        :param text: string
        :return: int
        :date: 10.01.2020
        :author: Vegas
        """

        match = re.search(r'(\d+)({:s}+)?'.format('+|'.join(powers.keys())), text, re.I)
        if match:
            moneyValue, suffixName = match.groups()
            moneyValue = int(moneyValue)
            if not suffixName:
                return moneyValue

            return moneyValue * (powers[suffixName[0]] ** len(suffixName))

        return 0

    def OnAccept(self):
        text = self.pickValueEditLine.GetText()
        if text:
            moneyValue = min(self.__ConvertMoneyText(text), self.maxValue)
            if moneyValue:
                if self.eventAccept:
                    self.eventAccept(moneyValue)

        self.Close()
Thank you for update and idea
 
Teşekkürler. Yabancıların kullandığı sistem daha iyi bence. her k harfi 3 tane 0 ediyor biliyorsunuzdur.

1k = 1k :D
1kk = 1m
1kkk = 1t
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst