[Question] For VB Programmers

08/22/2011 04:17 Keyeight#1
my friend who working at SSE wanna aske about why SSE not stable he didnt know it and he wanna some one explain it

it will be so nice if you helped us :)

and i wanna know what is the problem with this code

Code:
Option Explicit
Private Creator As String
Private pLen As Integer
Private i As Integer
Private x As Integer
Public Function Guild(index As Integer)
    Creator = "2231"
    Creator = Creator & "0000"
    Creator = Creator & PlayerData(index).CharID
    Creator = Creator & "0402"
    pLen = (Len(Creator) - 8) / 2
    Creator = WordFromInteger(pLen) & Creator
    frmMain.GSocket(index).SendData cv_StringFromHex(Creator)
    
    Creator = "C432"
    Creator = Creator & "0000"
    Creator = Creator & "02000000"                                          'Guild ID
    Creator = Creator & WordFromInteger(Len("Guild #2"))
    Creator = Creator & cv_HexFromString("Guild #2")                        'Guild Name
    Creator = Creator & "05"                                                'Guild Level
    Creator = Creator & "AEC10900"                                          'Guild Points
    Creator = Creator & WordFromInteger(Len("PAXEmu News"))
    Creator = Creator & cv_HexFromString("PAXEmu News")                      '1. Guild's Name
    Creator = Creator & WordFromInteger(Len("Check  [PAXEmu.smf4u.com]  for News or Updates"))
    Creator = Creator & cv_HexFromString("Check  [PAXEmu.smf4u.com]  for News or Updates")
    Creator = Creator & "0100000000"
    Creator = Creator & "01"                                                'Number Of Guildmember
    Creator = Creator & PlayerData(index).AccountId
    Creator = Creator & WordFromInteger(Len(PlayerData(index).Charname))
    Creator = Creator & cv_HexFromString(PlayerData(index).Charname)
    Creator = Creator & "0A"                                                '00=Master|0a=Member
    Creator = Creator & ByteFromInteger(PlayerData(index).level)
    Creator = Creator & "39050000"                                          'Donate Guild Points
    Creator = Creator & "FF"                                                'Authority
    Creator = Creator & "ffffff000000000000000000000000"
    Creator = Creator & "0A00" & cv_HexFromString("GameMaster")             'Grant Name
    Creator = Creator & DWordFromInteger(PlayerData(index).Chartype)
    Creator = Creator & "01"                                                'FortressWar Position
    Creator = Creator & "03"
    Creator = Creator & "00"                                                'End of Guildinformation
    pLen = (Len(Creator) - 8) / 2
    Creator = WordFromInteger(pLen) & Creator
    frmMain.GSocket(index).SendData cv_StringFromHex(Creator)
    
    
    Creator = "1E34"
    Creator = Creator & "0000"
    Creator = Creator & "01000000"                                          'Uni Leader Guild's ID
    Creator = Creator & "02"                                                'Number of Guilds in Uni
    Creator = Creator & "01000000"                                          '1. Guild's ID
    Creator = Creator & WordFromInteger(Len("Guild #1"))
    Creator = Creator & cv_HexFromString("Guild #1")                        '1. Guild's Name
    Creator = Creator & "05"                                                '1. Guild Level
    Creator = Creator & WordFromInteger(Len("Union Leader"))
    Creator = Creator & cv_HexFromString("Union Leader")                    'Uni Leader's Name
    Creator = Creator & "7F070000"                                          'Uni Leader's CharType
    Creator = Creator & "03"                                                '1. Guild Number of Member
    Creator = Creator & "02000000"                                          '2. Guild ID
    Creator = Creator & WordFromInteger(Len("Guild #2"))
    Creator = Creator & cv_HexFromString("Guild #2")                        '2. Guild Name
    Creator = Creator & "05"                                                '2. Guild Level
    Creator = Creator & WordFromInteger(Len(PlayerData(index).Charname))
    Creator = Creator & cv_HexFromString(PlayerData(index).Charname)
    Creator = Creator & DWordFromInteger(PlayerData(index).Chartype)
    Creator = Creator & "01"                                                '2. Guild Number of Member
    pLen = (Len(Creator) - 8) / 2
    Creator = WordFromInteger(pLen) & Creator
    frmMain.GSocket(index).SendData cv_StringFromHex(Creator)
    
    
    Creator = "5F36"
    Creator = Creator & "0000"
    Creator = Creator & PlayerData(index).CharID
    Creator = Creator & "02000000"                                          'Guild ID
    Creator = Creator & WordFromInteger(Len("SRVB Developers"))
    Creator = Creator & cv_HexFromString("SRVB Developers")                 'Guild Name
    Creator = Creator & WordFromInteger(Len("GameMaster"))
    Creator = Creator & cv_HexFromString("GameMaster")                      'Grant Name
    Creator = Creator & "01"                                                'Guild Icon ON
    Creator = Creator & "0000"
    Creator = Creator & "00000000000000"
    Creator = Creator & "01"                                                'Uni Icon ON
    Creator = Creator & "0000"
    pLen = (Len(Creator) - 8) / 2
    Creator = WordFromInteger(pLen) & Creator
    frmMain.GSocket(index).SendData cv_StringFromHex(Creator)
    
    Creator = "293B"
    Creator = Creator & "0000"
    Creator = Creator & "06"
    Creator = Creator & PlayerData(index).AccountId
    Creator = Creator & "0200"                                              'Guild Member Log on
    pLen = (Len(Creator) - 8) / 2
    Creator = WordFromInteger(pLen) & Creator
    frmMain.GSocket(index).SendData cv_StringFromHex(Creator)
End Function
Public Function ChangeNotice(index As Integer)
    Dim noticelen As String
    Dim noticetext As String
    Dim test As String
    noticelen = IntegerFromWord(Mid(Creator, 1, 4))
    noticetext = Mid(Creator, 5, (noticelen * 2))
    test = WordFromInteger(noticelen)
    Dim msglen As String
    Dim msglen2 As String
    msglen = Mid(Creator, Len(test) + Len(noticetext) + 1, 4)
    
    Creator = "293B"
    Creator = Creator & "0000"
    Creator = Creator & "0510"
    Creator = Creator & WordFromInteger(noticelen)
    Creator = Creator & noticetext
    Creator = Creator & msglen 'uzunluk
    'Creator = Creator & "00"
    msglen2 = IntegerFromWord(msglen)
    Creator = Creator & Mid(Creator, Len(test) + Len(noticetext) + 5, msglen2 * 2)
    pLen = (Len(Creator) - 8) / 2
    Creator = WordFromInteger(pLen) & Creator
    frmMain.GSocket(index).SendData cv_StringFromHex(Creator)
End Function

Public Function LeaveGuild(index As Integer)
'L(06) 00 O(29 3B) 00 00 03 28 99 0A 00 01
'....7........n....
'L(04) 00 O(E6 37) 00 00 D6 BE D6 03 01 00 6E B5 00 00 01
'MsgBox (Creator)
    Creator = "293B"
    Creator = Creator & "0000"
    Creator = Creator & "0028"
    Creator = Creator & "150A0001"
    pLen = (Len(Creator) - 8) / 2
    Creator = WordFromInteger(pLen) & Creator
    frmMain.GSocket(index).SendData cv_StringFromHex(Creator)

    Creator = "E637"
    Creator = Creator & "0000"
    Creator = Creator & PlayerData(index).CharID
    'Creator = Creator & "D6BED603"
    Creator = Creator & "0100"
    Creator = Creator & "6EB5"
    Creator = Creator & "000001"
    pLen = (Len(Creator) - 8) / 2
    Creator = WordFromInteger(pLen) & Creator
    frmMain.GSocket(index).SendData cv_StringFromHex(Creator)
End Function
08/22/2011 12:07 LastThief#2
decompiled shit
08/23/2011 09:28 lesderid#3
Quote:
Originally Posted by LastThief View Post
decompiled shit
Sadly, I don't think it is.

So umm, why does it suck?
Well, first of all, it uses string operations which is really slow when you just use built-in concat afaik.
Second, 90% of it is hardcoded, which just isn't a good thing to do. This shouldn't do much to the stability though.
And last, I don't see them using any writers, they just add the new value to the end of the string.