Advertisement
Guest User

Untitled

a guest
Apr 16th, 2018
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ' Protocol.bas - Handles all incoming / outgoing messages for client-server communications.
  3. ' Uses a binary protocol designed by myself.
  4. '
  5. ' Designed and implemented by Juan Martín Sotuyo Dodero (Maraxus)
  6. ' (juansotuyo@gmail.com)
  7. '**************************************************************
  8.  
  9. '**************************************************************************
  10. 'This program is free software; you can redistribute it and/or modify
  11. 'it under the terms of the Affero General Public License;
  12. 'either version 1 of the License, or any later version.
  13. '
  14. 'This program is distributed in the hope that it will be useful,
  15. 'but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. 'Affero General Public License for more details.
  18. '
  19. 'You should have received a copy of the Affero General Public License
  20. 'along with this program; if not, you can find it at http://www.affero.org/oagpl.html
  21. '**************************************************************************
  22.  
  23. ''
  24. 'Handles all incoming / outgoing packets for client - server communications
  25. 'The binary prtocol here used was designed by Juan Martín Sotuyo Dodero.
  26. 'This is the first time it's used in Alkon, though the second time it's coded.
  27. 'This implementation has several enhacements from the first design.
  28. '
  29. ' @file     Protocol.bas
  30. ' @author   Juan Martín Sotuyo Dodero (Maraxus) juansotuyo@gmail.com
  31. ' @version  1.0.0
  32. ' @date     20060517
  33.  
  34. Option Explicit
  35.  
  36. ''
  37. ' TODO : /BANIP y /UNBANIP ya no trabajan con nicks. Esto lo puede mentir en forma local el cliente con un paquete a NickToIp
  38.  
  39. ''
  40. 'When we have a list of strings, we use this to separate them and prevent
  41. 'having too many string lengths in the queue. Yes, each string is NULL-terminated :P
  42. Private Const SEPARATOR As String * 1 = vbNullChar
  43.  
  44. Private Type tFont
  45.  
  46.         red As Byte
  47.         green As Byte
  48.         blue As Byte
  49.         Bold As Boolean
  50.         Italic As Boolean
  51.  
  52. End Type
  53.  
  54. Private Enum ServerPacketID
  55.  
  56.         logged = 1                ' LOGGED
  57.        RemoveDialogs = 2         ' QTDL
  58.        RemoveCharDialog = 3      ' QDL
  59.        NavigateToggle = 4        ' NAVEG
  60.        Disconnect = 5            ' FINOK
  61.        CommerceEnd = 6           ' FINCOMOK
  62.        BankEnd = 7               ' FINBANOK
  63.        CommerceInit = 8          ' INITCOM
  64.        BankInit = 9              ' INITBANCO
  65.        UserCommerceInit = 10      ' INITCOMUSU
  66.        UserCommerceEnd = 11       ' FINCOMUSUOK
  67.        UserOfferConfirm = 12
  68.         CommerceChat = 13
  69.         ShowBlacksmithForm = 14    ' SFH
  70.        ShowCarpenterForm = 15     ' SFC
  71.        UpdateSta = 16             ' ASS
  72.        UpdateMana = 17            ' ASM
  73.        UpdateHP = 18              ' ASH
  74.        UpdateGold = 19            ' ASG
  75.        UpdateBankGold = 20
  76.         UpdateExp = 21             ' ASE
  77.        ChangeMap = 22             ' CM
  78.        PosUpdate = 23             ' PU
  79.        ChatOverHead = 24          ' ||
  80.        ConsoleMsg = 25            ' || - Beware!! its the same as above, but it was properly splitted
  81.        GuildChat = 26             ' |+
  82.        ShowMessageBox = 27        ' !!
  83.        UserIndexInServer = 28     ' IU
  84.        UserCharIndexInServer = 29 ' IP
  85.        CharacterCreate = 30       ' CC
  86.        CharacterRemove = 31       ' BP
  87.        CharacterChangeNick = 32
  88.         CharacterMove = 33         ' MP, +, * and _ '
  89.        CharacterAttackMovement = 34
  90.         ForceCharMove = 35
  91.         CharacterChange = 36       ' CP
  92.        ObjectCreate = 37          ' HO
  93.        ObjectDelete = 38          ' BO
  94.        BlockPosition = 39         ' BQ
  95.        PlayMIDI = 40              ' TM
  96.        PlayWave = 41              ' TW
  97.        guildList = 42             ' GL
  98.        AreaChanged = 43           ' CA
  99.        PauseToggle = 44           ' BKW
  100.        RainToggle = 45            ' LLU
  101.        CreateFX = 46              ' CFX
  102.        UpdateUserStats = 47       ' EST
  103.        WorkRequestTarget = 48     ' T01
  104.        ChangeInventorySlot = 49   ' CSI
  105.        ChangeBankSlot = 50        ' SBO
  106.        ChangeSpellSlot = 51       ' SHS
  107.        Atributes = 52            ' ATR
  108.        BlacksmithWeapons = 53     ' LAH
  109.        BlacksmithArmors = 54      ' LAR
  110.        CarpenterObjects = 55      ' OBR
  111.        RestOK = 56                ' DOK
  112.        ErrorMsg = 57              ' ERR
  113.        Blind = 58                 ' CEGU
  114.        Dumb = 59                  ' DUMB
  115.        ShowSignal = 60            ' MCAR
  116.        ChangeNPCInventorySlot = 61 ' NPCI
  117.        UpdateHungerAndThirst = 62 ' EHYS
  118.        Fame = 63                  ' FAMA
  119.        MiniStats = 64             ' MEST
  120.        LevelUp = 65               ' SUNI
  121.        AddForumMsg = 66           ' FMSG
  122.        ShowForumForm = 67         ' MFOR
  123.        SetInvisible = 68          ' NOVER
  124.        ' @@ PAQUETE 69 SIN USAR
  125.        MeditateToggle = 70        ' MEDOK
  126.        BlindNoMore = 71           ' NSEGUE
  127.        DumbNoMore = 72            ' NESTUP
  128.        SendSkills = 73            ' SKILLS
  129.        TrainerCreatureList = 74   ' LSTCRI
  130.        guildNews = 75             ' GUILDNE
  131.        OfferDetails = 76          ' PEACEDE & ALLIEDE
  132.        AlianceProposalsList = 77  ' ALLIEPR
  133.        PeaceProposalsList = 78    ' PEACEPR
  134.        CharacterInfo = 79         ' CHRINFO
  135.        GuildLeaderInfo = 80       ' LEADERI
  136.        GuildMemberInfo = 81
  137.         GuildDetails = 82          ' CLANDET
  138.        ShowGuildFundationForm = 83 ' SHOWFUN
  139.        ParalizeOK = 84           ' PARADOK
  140.        ShowUserRequest = 85       ' PETICIO
  141.        TradeOK = 86               ' TRANSOK
  142.        BankOK = 87                ' BANCOOK
  143.        ChangeUserTradeSlot = 88   ' COMUSUINV
  144.        SendNight = 89             ' NOC
  145.        Pong = 90
  146.         UpdateTagAndStatus = 91
  147.    
  148.         'GM messages
  149.        SpawnList = 92             ' SPL
  150.        ShowSOSForm = 93           ' MSOS
  151.        ShowMOTDEditionForm = 94   ' ZMOTD
  152.        ShowGMPanelForm = 95       ' ABPANEL
  153.        UserNameList = 96          ' LISTUSU
  154.        ShowDenounces = 97
  155.         RecordList = 98
  156.         RecordDetails = 99
  157.    
  158.         ShowGuildAlign = 100
  159.         ShowPartyForm = 101
  160.         UpdateStrenghtAndDexterity = 102
  161.         UpdateStrenght = 103
  162.         UpdateDexterity = 104
  163.         ' @@ Paquete 105 Libre
  164.        MultiMessage = 106
  165.         StopWorking = 107
  166.         CancelOfferItem = 108
  167.         StrDextRunningOut = 109
  168.         CharacterUpdateHP = 110
  169.         CreateDamage = 111
  170.         Canje = 112                 'Canjes
  171.        CanjePTS = 113             'Canjes
  172.        ControlUserRecive = 114
  173.         ControlUserShow = 115
  174.         SendScreen = 116 ' @@ Foto
  175.        MercadoList = 118
  176.         MontateToggle = 120
  177.        
  178. End Enum
  179.  
  180. Private Enum ClientPacketID
  181.  
  182.         LoginExistingChar = 1     'OLOGIN
  183.        ResetChar = 2
  184.         LoginNewChar = 3          'NLOGIN
  185.        Talk = 4                  ';
  186.        Yell = 5                  '-
  187.        Whisper = 6               '\
  188.        Walk = 7                  'M
  189.        RequestPositionUpdate = 8 'RPU
  190.        Attack = 9                'AT
  191.        PickUp = 10                'AG
  192.        SafeToggle = 11            '/SEG & SEG  (SEG's behaviour has to be coded in the client)
  193.        ResuscitationSafeToggle = 12
  194.         RequestGuildLeaderInfo = 13 'GLINFO
  195.        RequestAtributes = 14      'ATR
  196.        RequestFame = 15           'FAMA
  197.        RequestSkills = 16         'ESKI
  198.        RequestMiniStats = 17      'FEST
  199.        CommerceEnd = 18           'FINCOM
  200.        UserCommerceEnd = 19       'FINCOMUSU
  201.        UserCommerceConfirm = 20
  202.         CommerceChat = 21
  203.         BankEnd = 22               'FINBAN
  204.        UserCommerceOk = 23        'COMUSUOK
  205.        UserCommerceReject = 24    'COMUSUNO
  206.        Drop = 25                  'TI
  207.        CastSpell = 26             'LH
  208.        LeftClick = 27             'LC
  209.        DoubleClick = 28           'RC
  210.        Work = 29                  'UK
  211.        UseSpellMacro = 30         'UMH
  212.        UseItem = 31               'USA
  213.        CraftBlacksmith = 32       'CNS
  214.        CraftCarpenter = 33        'CNC
  215.        WorkLeftClick = 34         'WLC
  216.        CreateNewGuild = 35        'CIG
  217.        SpellInfo = 36             'INFS
  218.        EquipItem = 37             'EQUI
  219.        ChangeHeading = 38         'CHEA
  220.        ModifySkills = 39          'SKSE
  221.        Train = 40                 'ENTR
  222.        CommerceBuy = 41           'COMP
  223.        BankExtractItem = 42       'RETI
  224.        CommerceSell = 43          'VEND
  225.        BankDeposit = 44           'DEPO
  226.        ForumPost = 45             'DEMSG
  227.        MoveSpell = 46             'DESPHE
  228.        MoveBank = 47
  229.         ClanCodexUpdate = 48       'DESCOD
  230.        UserCommerceOffer = 49     'OFRECER
  231.        GuildAcceptPeace = 50      'ACEPPEAT
  232.        GuildRejectAlliance = 51  'RECPALIA
  233.        GuildRejectPeace = 52      'RECPPEAT
  234.        GuildAcceptAlliance = 53   'ACEPALIA
  235.        GuildOfferPeace = 54       'PEACEOFF
  236.        GuildOfferAlliance = 55    'ALLIEOFF
  237.        GuildAllianceDetails = 56  'ALLIEDET
  238.        GuildPeaceDetails = 57     'PEACEDET
  239.        GuildRequestJoinerInfo = 58 'ENVCOMEN
  240.        GuildAlliancePropList = 59 'ENVALPRO
  241.        GuildPeacePropList = 60    'ENVPROPP
  242.        GuildDeclareWar = 61       'DECGUERR
  243.        GuildNewWebsite = 62       'NEWWEBSI
  244.        GuildAcceptNewMember = 63  'ACEPTARI
  245.        GuildRejectNewMember = 64  'RECHAZAR
  246.        GuildKickMember = 65       'ECHARCLA
  247.        GuildUpdateNews = 66       'ACTGNEWS
  248.        GuildMemberInfo = 67       '1HRINFO<
  249.        GuildOpenElections = 68    'ABREELEC
  250.        GuildRequestMembership = 69 'SOLICITUD
  251.        GuildRequestDetails = 70   'CLANDETAILS
  252.        Online = 71                '/ONLINE
  253.        Quit = 72                  '/SALIR
  254.        GuildLeave = 73            '/SALIRCLAN
  255.        RequestAccountState = 74   '/BALANCE
  256.        PetStand = 75              '/QUIETO
  257.        PetFollow = 76             '/ACOMPAÑAR
  258.        ReleasePet = 77            '/LIBERAR
  259.        TrainList = 78             '/ENTRENAR
  260.        Rest = 79                  '/DESCANSAR
  261.        Meditate = 80              '/MEDITAR
  262.        Resucitate = 81            '/RESUCITAR
  263.        Heal = 82                  '/CURAR
  264.        Help = 83                  '/AYUDA
  265.        RequestStats = 84          '/EST
  266.        CommerceStart = 85         '/COMERCIAR
  267.        BankStart = 86             '/BOVEDA
  268.        Enlist = 87                '/ENLISTAR
  269.        Information = 88           '/INFORMACION
  270.        Reward = 89                '/RECOMPENSA
  271.        RequestMOTD = 90           '/MOTD
  272.        Uptime = 91                '/UPTIME
  273.        PartyLeave = 92            '/SALIRPARTY
  274.        PartyCreate = 93           '/CREARPARTY
  275.        PartyJoin = 94             '/PARTY
  276.        Inquiry = 95               '/ENCUESTA ( with no params )
  277.        GuildMessage = 96          '/CMSG
  278.        PartyMessage = 97          '/PMSG
  279.        CentinelReport = 98        '/CENTINELA
  280.        GuildOnline = 99           '/ONLINECLAN
  281.        PartyOnline = 100           '/ONLINEPARTY
  282.        CouncilMessage = 101        '/BMSG
  283.        RoleMasterRequest = 102     '/ROL
  284.        GMRequest = 103             '/GM
  285.        bugReport = 104             '/_BUG
  286.        ChangeDescription = 105     '/DESC
  287.        GuildVote = 106             '/VOTO
  288.        Punishments = 107           '/PENAS
  289.        ChangePassword = 108        '/CONTRASEÑA
  290.        Gamble = 109                '/APOSTAR
  291.        InquiryVote = 110           '/ENCUESTA ( with parameters )
  292.        LeaveFaction = 111          '/RETIRAR ( with no arguments )
  293.        BankExtractGold = 112       '/RETIRAR ( with arguments )
  294.        BankDepositGold = 113       '/DEPOSITAR
  295.        Denounce = 114              '/DENUNCIAR
  296.        GuildFundate = 115          '/FUNDARCLAN
  297.        GuildFundation = 116
  298.         PartyKick = 117             '/ECHARPARTY
  299.        PartySetLeader = 118        '/PARTYLIDER
  300.        PartyAcceptMember = 119     '/ACCEPTPARTY
  301.        Ping = 120                  '/PING
  302.    
  303.         RequestPartyForm = 121
  304.         ItemUpgrade = 122
  305.         GMCommands = 123
  306.         InitCrafting = 124
  307.         Home = 125
  308.         ShowGuildNews = 126
  309.         ShareNpc = 127              '/COMPARTIRNPC
  310.        StopSharingNpc = 128        '/NOCOMPARTIRNPC
  311.        Consultation = 129
  312.         MoveItem = 130              'Drag and drop
  313.        PMDeleteList = 131
  314.         PMList = 132
  315.         otherSendReto = 133 ' @@ 1 vs 1
  316.        SendReto = 134      ' @@ 2 vs 2
  317.        AcceptReto = 135  ' @@ Aceptar 1.1 | 2.2
  318.        DropObjTo = 136
  319.         SetMenu = 137
  320.         Canjear = 138               'Mab
  321.        Canjesx = 139                'kidral
  322.        ChangeCara = 140
  323.         ControlUserRequest = 141
  324.         ControlUserSendData = 142
  325.         RequestScreen = 143
  326.         regresar = 144
  327.         Retos = 146
  328. End Enum
  329.  
  330. Public Enum eGMCommands
  331.  
  332.         GMMessage = 1           '/GMSG
  333.        showName = 2              '/SHOWNAME
  334.        OnlineRoyalArmy = 3       '/ONLINEREAL
  335.        OnlineChaosLegion = 4     '/ONLINECAOS
  336.        GoNearby = 5              '/IRCERCA
  337.        Comment = 6               '/REM
  338.        serverTime = 7            '/HORA
  339.        Where = 8                 '/DONDE
  340.        CreaturesInMap = 9        '/NENE
  341.        WarpMeToTarget = 10        '/TELEPLOC
  342.        WarpChar = 11              '/TELEP
  343.        Silence = 12               '/SILENCIAR
  344.        SOSShowList = 13           '/SHOW SOS
  345.        SOSRemove = 14             'SOSDONE
  346.        GoToChar = 15              '/IRA
  347.        invisible = 16             '/INVISIBLE
  348.        GMPanel = 17               '/PANELGM
  349.        RequestUserList = 18       'LISTUSU
  350.        Working = 19               '/TRABAJANDO
  351.        Hiding = 20                '/OCULTANDO
  352.        Jail = 21                  '/CARCEL
  353.        KillNPC = 22               '/RMATA
  354.        WarnUser = 23              '/ADVERTENCIA
  355.        EditChar = 24              '/MOD
  356.        RequestCharInfo = 25       '/INFO
  357.        RequestCharStats = 26      '/STAT
  358.        RequestCharGold = 27       '/BAL
  359.        RequestCharInventory = 28  '/INV
  360.        RequestCharBank = 29       '/BOV
  361.        RequestCharSkills = 30     '/SKILLS
  362.        ReviveChar = 31            '/REVIVIR
  363.        OnlineGM = 32              '/ONLINEGM
  364.        OnlineMap = 33             '/ONLINEMAP
  365.        Forgive = 34               '/PERDON
  366.        Kick = 35                  '/ECHAR
  367.        Execute = 36               '/EJECUTAR
  368.        banChar = 37               '/BAN
  369.        UnbanChar = 38             '/UNBAN
  370.        NPCFollow = 39             '/SEGUIR
  371.        SummonChar = 41            '/SUM
  372.        SpawnListRequest = 42      '/CC
  373.        SpawnCreature = 43         'SPA
  374.        ResetNPCInventory = 44     '/RESETINV
  375.        CleanWorld = 45            '/LIMPIAR
  376.        ServerMessage = 46         '/RMSG
  377.        nickToIP = 47              '/NICK2IP
  378.        IPToNick = 48              '/IP2NICK
  379.        GuildOnlineMembers = 49    '/ONCLAN
  380.        TeleportCreate = 50        '/CT
  381.        TeleportDestroy = 51       '/DT
  382.        RainToggle = 52            '/LLUVIA
  383.        SetCharDescription = 53    '/SETDESC
  384.        ForceMIDIToMap = 54        '/FORCEMIDIMAP
  385.        ForceWAVEToMap = 55        '/FORCEWAVMAP
  386.        RoyalArmyMessage = 56      '/REALMSG
  387.        ChaosLegionMessage = 57    '/CAOSMSG
  388.        CitizenMessage = 58        '/CIUMSG
  389.        CriminalMessage = 59       '/CRIMSG
  390.        TalkAsNPC = 60             '/TALKAS
  391.        DestroyAllItemsInArea = 61 '/MASSDEST
  392.        AcceptRoyalCouncilMember = 62 '/ACEPTCONSE
  393.        AcceptChaosCouncilMember = 63 '/ACEPTCONSECAOS
  394.        ItemsInTheFloor = 64       '/PISO
  395.        MakeDumb = 65              '/ESTUPIDO
  396.        MakeDumbNoMore = 66        '/NOESTUPIDO
  397.        dumpIPTables = 67          '/DUMPSECURITY
  398.        CouncilKick = 68           '/KICKCONSE
  399.        SetTrigger = 69            '/TRIGGER
  400.        AskTrigger = 70            '/TRIGGER with no args
  401.        BannedIPList = 71          '/BANIPLIST
  402.        BannedIPReload = 72        '/BANIPRELOAD
  403.        GuildMemberList = 73       '/MIEMBROSCLAN
  404.        GuildBan = 74              '/BANCLAN
  405.        BanIP = 75                 '/BANIP
  406.        UnbanIP = 76               '/UNBANIP
  407.        CreateItem = 77            '/CI
  408.        DestroyItems = 78          '/DEST
  409.        ChaosLegionKick = 79       '/NOCAOS
  410.        RoyalArmyKick = 80         '/NOREAL
  411.        ForceMIDIAll = 81          '/FORCEMIDI
  412.        ForceWAVEAll = 82          '/FORCEWAV
  413.        RemovePunishment = 83      '/BORRARPENA
  414.        TileBlockedToggle = 84     '/BLOQ
  415.        KillNPCNoRespawn = 85      '/MATA
  416.        KillAllNearbyNPCs = 86     '/MASSKILL
  417.        LastIP = 87                '/LASTIP
  418.        ChangeMOTD = 88            '/MOTDCAMBIA
  419.        SetMOTD = 89               'ZMOTD
  420.        SystemMessage = 90         '/SMSG
  421.        CreateNPC = 91             '/ACC
  422.        CreateNPCWithRespawn = 92  '/RACC
  423.        ImperialArmour = 93        '/AI1 - 4
  424.        ChaosArmour = 94           '/AC1 - 4
  425.        NavigateToggle = 95        '/NAVE
  426.        ServerOpenToUsersToggle = 96 '/HABILITAR
  427.        TurnOffServer = 97         '/APAGAR
  428.        TurnCriminal = 98          '/CONDEN
  429.        ResetFactions = 99         '/RAJAR
  430.        RemoveCharFromGuild = 100   '/RAJARCLAN
  431.        RequestCharMail = 101       '/LASTEMAIL
  432.        AlterPassword = 102         '/APASS
  433.        AlterMail = 103             '/AEMAIL
  434.        AlterName = 104             '/ANAME
  435.        ToggleCentinelActivated = 105 '/CENTINELAACTIVADO
  436.        DoBackUp = 106              '/DOBACKUP
  437.        ShowGuildMessages = 107     '/SHOWCMSG
  438.        SaveMap = 108               '/GUARDAMAPA
  439.        ChangeMapInfoPK = 109       '/MODMAPINFO PK
  440.        ChangeMapInfoBackup = 110   '/MODMAPINFO BACKUP
  441.        ChangeMapInfoRestricted = 111 '/MODMAPINFO RESTRINGIR
  442.        ChangeMapInfoNoMagic = 112  '/MODMAPINFO MAGIASINEFECTO
  443.        ChangeMapInfoNoInvi = 113   '/MODMAPINFO INVISINEFECTO
  444.        ChangeMapInfoNoResu = 114   '/MODMAPINFO RESUSINEFECTO
  445.        ChangeMapInfoLand = 115     '/MODMAPINFO TERRENO
  446.        ChangeMapInfoZone = 116     '/MODMAPINFO ZONA
  447.        ChangeMapInfoStealNpc = 117 '/MODMAPINFO ROBONPCm
  448.        ChangeMapInfoNoOcultar = 118 '/MODMAPINFO OCULTARSINEFECTO
  449.        ChangeMapInfoNoInvocar = 119 '/MODMAPINFO INVOCARSINEFECTO
  450.        SaveChars = 120             '/GRABAR
  451.        CleanSOS = 121              '/BORRAR SOS
  452.        ShowServerForm = 122        '/SHOW INT
  453.        night = 123                 '/NOCHE
  454.        KickAllChars = 124          '/ECHARTODOSPJS
  455.        ReloadNPCs = 125            '/RELOADNPCS
  456.        ReloadServerIni = 126       '/RELOADSINI
  457.        ReloadSpells = 127          '/RELOADHECHIZOS
  458.        ReloadObjects = 128         '/RELOADOBJ
  459.        Restart = 129               '/REINICIAR
  460.        ResetAutoUpdate = 130       '/AUTOUPDATE
  461.        ChatColor = 131             '/CHATCOLOR
  462.        Ignored = 132               '/IGNORADO
  463.        CheckSlot = 133             '/SLOT
  464.        SetIniVar = 134             '/SETINIVAR LLAVE CLAVE VALOR
  465.        CreatePretorianClan = 135   '/CREARPRETORIANOS
  466.        RemovePretorianClan = 136   '/ELIMINARPRETORIANOS
  467.        EnableDenounces = 137       '/DENUNCIAS
  468.        ShowDenouncesList = 138     '/SHOW DENUNCIAS
  469.        MapMessage = 139            '/MAPMSG
  470.        SetDialog = 140             '/SETDIALOG
  471.        Impersonate = 141           '/IMPERSONAR
  472.        Imitate = 142               '/MIMETIZAR
  473.        RecordAdd = 143
  474.         RecordRemove = 144
  475.         RecordAddObs = 145
  476.         RecordListRequest = 146
  477.         RecordDetailsRequest = 147
  478.  
  479.         PMSend = 148
  480.         PMDeleteUser = 149
  481.         PMListUser = 150
  482.        
  483.         SetPuntosShop = 151
  484.         Countdown = 152
  485. End Enum
  486.  
  487. Public Enum FontTypeNames
  488.  
  489.         FONTTYPE_TALK
  490.         FONTTYPE_FIGHT
  491.         FONTTYPE_WARNING
  492.         FONTTYPE_INFO
  493.         FONTTYPE_INFOBOLD
  494.         FONTTYPE_EJECUCION
  495.         FONTTYPE_PARTY
  496.         FONTTYPE_VENENO
  497.         FONTTYPE_GUILD
  498.         FONTTYPE_SERVER
  499.         FONTTYPE_GUILDMSG
  500.         FONTTYPE_CONSEJO
  501.         FONTTYPE_CONSEJOCAOS
  502.         FONTTYPE_CONSEJOVesA
  503.         FONTTYPE_CONSEJOCAOSVesA
  504.         FONTTYPE_CENTINELA
  505.         FONTTYPE_GMMSG
  506.         FONTTYPE_GM
  507.         FONTTYPE_CITIZEN
  508.         FONTTYPE_CONSE
  509.         FONTTYPE_DIOS
  510.  
  511. End Enum
  512.  
  513. Public FontTypes(21) As tFont
  514.  
  515. ''
  516. ' Initializes the fonts array
  517.  
  518. Public Sub InitFonts()
  519.  
  520.         '***************************************************
  521.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  522.        'Last Modification: 05/17/06
  523.        '
  524.        '***************************************************
  525.        With FontTypes(FontTypeNames.FONTTYPE_TALK)
  526.                 .red = 255
  527.                 .green = 255
  528.                 .blue = 255
  529.  
  530.         End With
  531.    
  532.         With FontTypes(FontTypeNames.FONTTYPE_FIGHT)
  533.                 .red = 255
  534.                 .Bold = 1
  535.  
  536.         End With
  537.    
  538.         With FontTypes(FontTypeNames.FONTTYPE_WARNING)
  539.                 .red = 32
  540.                 .green = 51
  541.                 .blue = 223
  542.                 .Bold = 1
  543.                 .Italic = 1
  544.  
  545.         End With
  546.    
  547.         With FontTypes(FontTypeNames.FONTTYPE_INFO)
  548.                 .red = 65
  549.                 .green = 190
  550.                 .blue = 156
  551.  
  552.         End With
  553.    
  554.         With FontTypes(FontTypeNames.FONTTYPE_INFOBOLD)
  555.                 .red = 65
  556.                 .green = 190
  557.                 .blue = 156
  558.                 .Bold = 1
  559.  
  560.         End With
  561.    
  562.         With FontTypes(FontTypeNames.FONTTYPE_EJECUCION)
  563.                 .red = 130
  564.                 .green = 130
  565.                 .blue = 130
  566.                 .Bold = 1
  567.  
  568.         End With
  569.    
  570.         With FontTypes(FontTypeNames.FONTTYPE_PARTY)
  571.                 .red = 255
  572.                 .green = 180
  573.                 .blue = 250
  574.  
  575.         End With
  576.    
  577.         FontTypes(FontTypeNames.FONTTYPE_VENENO).green = 255
  578.    
  579.         With FontTypes(FontTypeNames.FONTTYPE_GUILD)
  580.                 .red = 255
  581.                 .green = 255
  582.                 .blue = 255
  583.                 .Bold = 1
  584.  
  585.         End With
  586.    
  587.         FontTypes(FontTypeNames.FONTTYPE_SERVER).green = 185
  588.    
  589.         With FontTypes(FontTypeNames.FONTTYPE_GUILDMSG)
  590.                 .red = 228
  591.                 .green = 199
  592.                 .blue = 27
  593.  
  594.         End With
  595.    
  596.         With FontTypes(FontTypeNames.FONTTYPE_CONSEJO)
  597.                 .red = 130
  598.                 .green = 130
  599.                 .blue = 255
  600.                 .Bold = 1
  601.  
  602.         End With
  603.    
  604.         With FontTypes(FontTypeNames.FONTTYPE_CONSEJOCAOS)
  605.                 .red = 255
  606.                 .green = 60
  607.                 .Bold = 1
  608.  
  609.         End With
  610.    
  611.         With FontTypes(FontTypeNames.FONTTYPE_CONSEJOVesA)
  612.                 .green = 200
  613.                 .blue = 255
  614.                 .Bold = 1
  615.  
  616.         End With
  617.    
  618.         With FontTypes(FontTypeNames.FONTTYPE_CONSEJOCAOSVesA)
  619.                 .red = 255
  620.                 .green = 50
  621.                 .Bold = 1
  622.  
  623.         End With
  624.    
  625.         With FontTypes(FontTypeNames.FONTTYPE_CENTINELA)
  626.                 .green = 255
  627.                 .Bold = 1
  628.  
  629.         End With
  630.    
  631.         With FontTypes(FontTypeNames.FONTTYPE_GMMSG)
  632.                 .red = 255
  633.                 .green = 255
  634.                 .blue = 255
  635.                 .Italic = 1
  636.  
  637.         End With
  638.    
  639.         With FontTypes(FontTypeNames.FONTTYPE_GM)
  640.                 .red = 30
  641.                 .green = 255
  642.                 .blue = 30
  643.                 .Bold = 1
  644.  
  645.         End With
  646.    
  647.         With FontTypes(FontTypeNames.FONTTYPE_CITIZEN)
  648.                 .blue = 200
  649.                 .Bold = 1
  650.  
  651.         End With
  652.    
  653.         With FontTypes(FontTypeNames.FONTTYPE_CONSE)
  654.                 .red = 30
  655.                 .green = 150
  656.                 .blue = 30
  657.                 .Bold = 1
  658.  
  659.         End With
  660.    
  661.         With FontTypes(FontTypeNames.FONTTYPE_DIOS)
  662.                 .red = 250
  663.                 .green = 250
  664.                 .blue = 150
  665.                 .Bold = 1
  666.  
  667.         End With
  668.  
  669. End Sub
  670.  
  671. ''
  672. ' Handles incoming data.
  673.  
  674. Public Sub HandleIncomingData()
  675.  
  676.         '***************************************************
  677.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  678.        'Last Modification: 05/17/06
  679.        '
  680.        '***************************************************
  681.        On Error Resume Next
  682.  
  683.         Dim Packet As Byte
  684.  
  685.         Packet = incomingData.PeekByte()
  686.         'Debug.Print Packet
  687.    
  688.         Select Case Packet
  689.  
  690.                 Case ServerPacketID.logged                  ' LOGGED
  691.                        Call HandleLogged
  692.        
  693.                 Case ServerPacketID.RemoveDialogs           ' QTDL
  694.                        Call HandleRemoveDialogs
  695.        
  696.                 Case ServerPacketID.RemoveCharDialog        ' QDL
  697.                        Call HandleRemoveCharDialog
  698.        
  699.                 Case ServerPacketID.NavigateToggle          ' NAVEG
  700.                        Call HandleNavigateToggle
  701.        
  702.                 Case ServerPacketID.Disconnect              ' FINOK
  703.                        Call HandleDisconnect
  704.        
  705.                 Case ServerPacketID.CommerceEnd             ' FINCOMOK
  706.                        Call HandleCommerceEnd
  707.            
  708.                 Case ServerPacketID.CommerceChat
  709.                         Call HandleCommerceChat
  710.        
  711.                 Case ServerPacketID.BankEnd                 ' FINBANOK
  712.                        Call HandleBankEnd
  713.        
  714.                 Case ServerPacketID.CommerceInit            ' INITCOM
  715.                        Call HandleCommerceInit
  716.        
  717.                 Case ServerPacketID.BankInit                ' INITBANCO
  718.                        Call HandleBankInit
  719.        
  720.                 Case ServerPacketID.UserCommerceInit        ' INITCOMUSU
  721.                        Call HandleUserCommerceInit
  722.        
  723.                 Case ServerPacketID.UserCommerceEnd         ' FINCOMUSUOK
  724.                        Call HandleUserCommerceEnd
  725.            
  726.                 Case ServerPacketID.UserOfferConfirm
  727.                         Call HandleUserOfferConfirm
  728.        
  729.                 Case ServerPacketID.ShowBlacksmithForm      ' SFH
  730.                        Call HandleShowBlacksmithForm
  731.        
  732.                 Case ServerPacketID.ShowCarpenterForm       ' SFC
  733.                        Call HandleShowCarpenterForm
  734.        
  735.                 Case ServerPacketID.UpdateSta               ' ASS
  736.                        Call HandleUpdateSta
  737.        
  738.                 Case ServerPacketID.UpdateMana              ' ASM
  739.                        Call HandleUpdateMana
  740.        
  741.                 Case ServerPacketID.UpdateHP                ' ASH
  742.                        Call HandleUpdateHP
  743.        
  744.                 Case ServerPacketID.UpdateGold              ' ASG
  745.                        Call HandleUpdateGold
  746.            
  747.                 Case ServerPacketID.UpdateBankGold
  748.                         Call HandleUpdateBankGold
  749.  
  750.                 Case ServerPacketID.UpdateExp               ' ASE
  751.                        Call HandleUpdateExp
  752.        
  753.                 Case ServerPacketID.ChangeMap               ' CM
  754.                        Call HandleChangeMap
  755.        
  756.                 Case ServerPacketID.PosUpdate               ' PU
  757.                        Call HandlePosUpdate
  758.        
  759.                 Case ServerPacketID.ChatOverHead            ' ||
  760.                        Call HandleChatOverHead
  761.        
  762.                 Case ServerPacketID.ConsoleMsg              ' || - Beware!! its the same as above, but it was properly splitted
  763.                        Call HandleConsoleMessage
  764.        
  765.                 Case ServerPacketID.GuildChat               ' |+
  766.                        Call HandleGuildChat
  767.        
  768.                 Case ServerPacketID.ShowMessageBox          ' !!
  769.                        Call HandleShowMessageBox
  770.        
  771.                 Case ServerPacketID.UserIndexInServer       ' IU
  772.                        Call HandleUserIndexInServer
  773.        
  774.                 Case ServerPacketID.UserCharIndexInServer   ' IP
  775.                        Call HandleUserCharIndexInServer
  776.        
  777.                 Case ServerPacketID.CharacterCreate         ' CC
  778.                        Call HandleCharacterCreate
  779.        
  780.                 Case ServerPacketID.CharacterRemove         ' BP
  781.                        Call HandleCharacterRemove
  782.        
  783.                 Case ServerPacketID.CharacterChangeNick
  784.                         Call HandleCharacterChangeNick
  785.            
  786.                 Case ServerPacketID.CharacterMove           ' MP, +, * and _ '
  787.                        Call HandleCharacterMove
  788.        
  789.                 Case ServerPacketID.CharacterAttackMovement
  790.                         Call HandleCharacterAttackMovement
  791.            
  792.                 Case ServerPacketID.ForceCharMove
  793.                         Call HandleForceCharMove
  794.        
  795.                 Case ServerPacketID.CharacterChange         ' CP
  796.                        Call HandleCharacterChange
  797.        
  798.                 Case ServerPacketID.ObjectCreate            ' HO
  799.                        Call HandleObjectCreate
  800.        
  801.                 Case ServerPacketID.ObjectDelete            ' BO
  802.                        Call HandleObjectDelete
  803.        
  804.                 Case ServerPacketID.BlockPosition           ' BQ
  805.                        Call HandleBlockPosition
  806.        
  807.                 Case ServerPacketID.PlayMIDI                ' TM
  808.                        Call HandlePlayMIDI
  809.        
  810.                 Case ServerPacketID.PlayWave                ' TW
  811.                        Call HandlePlayWave
  812.        
  813.                 Case ServerPacketID.guildList               ' GL
  814.                        Call HandleGuildList
  815.        
  816.                 Case ServerPacketID.AreaChanged             ' CA
  817.                        Call HandleAreaChanged
  818.        
  819.                 Case ServerPacketID.PauseToggle             ' BKW
  820.                        Call HandlePauseToggle
  821.        
  822.                 Case ServerPacketID.RainToggle              ' LLU
  823.                        Call HandleRainToggle
  824.        
  825.                 Case ServerPacketID.CreateFX                ' CFX
  826.                        Call HandleCreateFX
  827.        
  828.                 Case ServerPacketID.UpdateUserStats         ' EST
  829.                        Call HandleUpdateUserStats
  830.        
  831.                 Case ServerPacketID.WorkRequestTarget       ' T01
  832.                        Call HandleWorkRequestTarget
  833.        
  834.                 Case ServerPacketID.ChangeInventorySlot     ' CSI
  835.                        Call HandleChangeInventorySlot
  836.        
  837.                 Case ServerPacketID.ChangeBankSlot          ' SBO
  838.                        Call HandleChangeBankSlot
  839.        
  840.                 Case ServerPacketID.ChangeSpellSlot         ' SHS
  841.                        Call HandleChangeSpellSlot
  842.        
  843.                 Case ServerPacketID.Atributes               ' ATR
  844.                        Call HandleAtributes
  845.        
  846.                 Case ServerPacketID.BlacksmithWeapons       ' LAH
  847.                        Call HandleBlacksmithWeapons
  848.        
  849.                 Case ServerPacketID.BlacksmithArmors        ' LAR
  850.                        Call HandleBlacksmithArmors
  851.        
  852.                 Case ServerPacketID.CarpenterObjects        ' OBR
  853.                        Call HandleCarpenterObjects
  854.        
  855.                 Case ServerPacketID.RestOK                  ' DOK
  856.                        Call HandleRestOK
  857.        
  858.                 Case ServerPacketID.ErrorMsg                ' ERR
  859.                        Call HandleErrorMessage
  860.        
  861.                 Case ServerPacketID.Blind                   ' CEGU
  862.                        Call HandleBlind
  863.        
  864.                 Case ServerPacketID.Dumb                    ' DUMB
  865.                        Call HandleDumb
  866.        
  867.                 Case ServerPacketID.ShowSignal              ' MCAR
  868.                        Call HandleShowSignal
  869.        
  870.                 Case ServerPacketID.ChangeNPCInventorySlot  ' NPCI
  871.                        Call HandleChangeNPCInventorySlot
  872.        
  873.                 Case ServerPacketID.UpdateHungerAndThirst   ' EHYS
  874.                        Call HandleUpdateHungerAndThirst
  875.        
  876.                 Case ServerPacketID.Fame                    ' FAMA
  877.                        Call HandleFame
  878.        
  879.                 Case ServerPacketID.MiniStats               ' MEST
  880.                        Call HandleMiniStats
  881.        
  882.                 Case ServerPacketID.LevelUp                 ' SUNI
  883.                        Call HandleLevelUp
  884.        
  885.                 Case ServerPacketID.AddForumMsg             ' FMSG
  886.                        Call HandleAddForumMessage
  887.        
  888.                 Case ServerPacketID.ShowForumForm           ' MFOR
  889.                        Call HandleShowForumForm
  890.        
  891.                 Case ServerPacketID.SetInvisible            ' NOVER
  892.                        Call HandleSetInvisible
  893.        
  894.                 Case ServerPacketID.MeditateToggle          ' MEDOK
  895.                        Call HandleMeditateToggle
  896.        
  897.                 Case ServerPacketID.BlindNoMore             ' NSEGUE
  898.                        Call HandleBlindNoMore
  899.        
  900.                 Case ServerPacketID.DumbNoMore              ' NESTUP
  901.                        Call HandleDumbNoMore
  902.        
  903.                 Case ServerPacketID.SendSkills              ' SKILLS
  904.                        Call HandleSendSkills
  905.        
  906.                 Case ServerPacketID.TrainerCreatureList     ' LSTCRI
  907.                        Call HandleTrainerCreatureList
  908.        
  909.                 Case ServerPacketID.guildNews               ' GUILDNE
  910.                        Call HandleGuildNews
  911.        
  912.                 Case ServerPacketID.OfferDetails            ' PEACEDE and ALLIEDE
  913.                        Call HandleOfferDetails
  914.        
  915.                 Case ServerPacketID.AlianceProposalsList    ' ALLIEPR
  916.                        Call HandleAlianceProposalsList
  917.        
  918.                 Case ServerPacketID.PeaceProposalsList      ' PEACEPR
  919.                        Call HandlePeaceProposalsList
  920.        
  921.                 Case ServerPacketID.CharacterInfo           ' CHRINFO
  922.                        Call HandleCharacterInfo
  923.        
  924.                 Case ServerPacketID.GuildLeaderInfo         ' LEADERI
  925.                        Call HandleGuildLeaderInfo
  926.        
  927.                 Case ServerPacketID.GuildDetails            ' CLANDET
  928.                        Call HandleGuildDetails
  929.        
  930.                 Case ServerPacketID.ShowGuildFundationForm  ' SHOWFUN
  931.                        Call HandleShowGuildFundationForm
  932.        
  933.                 Case ServerPacketID.ParalizeOK              ' PARADOK
  934.                        Call HandleParalizeOK
  935.        
  936.                 Case ServerPacketID.ShowUserRequest         ' PETICIO
  937.                        Call HandleShowUserRequest
  938.        
  939.                 Case ServerPacketID.TradeOK                 ' TRANSOK
  940.                        Call HandleTradeOK
  941.        
  942.                 Case ServerPacketID.BankOK                  ' BANCOOK
  943.                        Call HandleBankOK
  944.        
  945.                 Case ServerPacketID.ChangeUserTradeSlot     ' COMUSUINV
  946.                        Call HandleChangeUserTradeSlot
  947.            
  948.                 Case ServerPacketID.SendNight               ' NOC
  949.                        Call HandleSendNight
  950.        
  951.                 Case ServerPacketID.Pong
  952.                         Call HandlePong
  953.        
  954.                 Case ServerPacketID.UpdateTagAndStatus
  955.                         Call HandleUpdateTagAndStatus
  956.        
  957.                 Case ServerPacketID.GuildMemberInfo
  958.                         Call HandleGuildMemberInfo
  959.        
  960.                         '*******************
  961.                        'GM messages
  962.                        '*******************
  963.                Case ServerPacketID.SpawnList               ' SPL
  964.                        Call HandleSpawnList
  965.        
  966.                 Case ServerPacketID.ShowSOSForm             ' RSOS and MSOS
  967.                        Call HandleShowSOSForm
  968.            
  969.                 Case ServerPacketID.ShowDenounces
  970.                         Call HandleShowDenounces
  971.            
  972.                 Case ServerPacketID.RecordDetails
  973.                         Call HandleRecordDetails
  974.            
  975.                 Case ServerPacketID.RecordList
  976.                         Call HandleRecordList
  977.            
  978.                 Case ServerPacketID.ShowMOTDEditionForm     ' ZMOTD
  979.                        Call HandleShowMOTDEditionForm
  980.        
  981.                 Case ServerPacketID.ShowGMPanelForm         ' ABPANEL
  982.                        Call HandleShowGMPanelForm
  983.        
  984.                 Case ServerPacketID.UserNameList            ' LISTUSU
  985.                        Call HandleUserNameList
  986.            
  987.                 Case ServerPacketID.ShowGuildAlign
  988.                         Call HandleShowGuildAlign
  989.        
  990.                 Case ServerPacketID.ShowPartyForm
  991.                         Call HandleShowPartyForm
  992.        
  993.                 Case ServerPacketID.UpdateStrenghtAndDexterity
  994.                         Call HandleUpdateStrenghtAndDexterity
  995.            
  996.                 Case ServerPacketID.UpdateStrenght
  997.                         Call HandleUpdateStrenght
  998.            
  999.                 Case ServerPacketID.UpdateDexterity
  1000.                         Call HandleUpdateDexterity
  1001.  
  1002.                 Case ServerPacketID.MultiMessage
  1003.                         Call HandleMultiMessage
  1004.        
  1005.                 Case ServerPacketID.StopWorking
  1006.                         Call HandleStopWorking
  1007.            
  1008.                 Case ServerPacketID.CancelOfferItem
  1009.                         Call HandleCancelOfferItem
  1010.            
  1011.                 Case ServerPacketID.StrDextRunningOut
  1012.                         Call HandleStrDextRunningOut
  1013.                        
  1014.                 Case ServerPacketID.CharacterUpdateHP
  1015.                         Call HandleCharacterUpdateHP
  1016.                        
  1017.                 Case ServerPacketID.CreateDamage            ' CDMG
  1018.                        Call HandleCreateDamage
  1019.                        
  1020.                 Case ServerPacketID.Canje                ' kidral
  1021.                        Call HandleCanje
  1022.            
  1023.                 Case ServerPacketID.CanjePTS                ' kidral
  1024.                        Call HandlePuntos
  1025.                        
  1026.                 Case ServerPacketID.ControlUserRecive
  1027.                         Call HandleReciveControlUser
  1028.  
  1029.                 Case ServerPacketID.ControlUserShow
  1030.                         Call HandleShowControlUser
  1031.                        
  1032.                 Case ServerPacketID.SendScreen
  1033.                         Call handleSendScreen
  1034.  
  1035.                 Case ServerPacketID.MercadoList     ' LSTCRI
  1036.                        Call HandleMercadoList
  1037.            
  1038.             Case ServerPacketID.MontateToggle           'monturas
  1039.            Call HandleMontateToggle
  1040.            
  1041.                 Case Else
  1042.                         'ERROR : Abort!
  1043.                        Exit Sub
  1044.  
  1045.         End Select
  1046.    
  1047.         'Done with this packet, move on to next one
  1048.        If incomingData.Length > 0 And Err.number <> incomingData.NotEnoughDataErrCode Then
  1049.                 Err.Clear
  1050.                 Call HandleIncomingData
  1051.  
  1052.         End If
  1053.  
  1054. End Sub
  1055.  
  1056. Public Sub HandleMultiMessage()
  1057.  
  1058.         '***************************************************
  1059.        'Author: Unknown
  1060.        'Last Modification: 11/16/2010
  1061.        ' 09/28/2010: C4b3z0n - Ahora se le saco la "," a los minutos de distancia del /hogar, ya que a veces quedaba "12,5 minutos y 30segundos"
  1062.        ' 09/21/2010: C4b3z0n - Now the fragshooter operates taking the screen after the change of killed charindex to ghost only if target charindex is visible to the client, else it will take screenshot like before.
  1063.        ' 11/16/2010: Amraphen - Recoded how the FragShooter works.
  1064.        '***************************************************
  1065.        Dim BodyPart As Byte
  1066.  
  1067.         Dim Daño As Integer
  1068.    
  1069.         With incomingData
  1070.                 Call .ReadByte
  1071.    
  1072.                 Select Case .ReadByte
  1073.  
  1074.                         'Case eMessages.DontSeeAnything
  1075.                          '     Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_NO_VES_NADA_INTERESANTE, 65, 190, 156, False, False, True)
  1076.        
  1077.                         Case eMessages.NPCSwing
  1078.                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_CRIATURA_FALLA_GOLPE, 255, 0, 0, True, False, True)
  1079.        
  1080.                         Case eMessages.NPCKillUser
  1081.                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_CRIATURA_MATADO, 255, 0, 0, True, False, True)
  1082.        
  1083.                         Case eMessages.BlockedWithShieldUser
  1084.                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_RECHAZO_ATAQUE_ESCUDO, 255, 0, 0, True, False, True)
  1085.        
  1086.                         Case eMessages.BlockedWithShieldOther
  1087.                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_USUARIO_RECHAZO_ATAQUE_ESCUDO, 255, 0, 0, True, False, True)
  1088.        
  1089.                         Case eMessages.UserSwing
  1090.                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_FALLADO_GOLPE, 255, 0, 0, True, False, True)
  1091.        
  1092.                         Case eMessages.SafeModeOn
  1093.                                 Call frmMain.ControlSM(eSMType.sSafemode, True)
  1094.        
  1095.                         Case eMessages.SafeModeOff
  1096.                                 Call frmMain.ControlSM(eSMType.sSafemode, False)
  1097.        
  1098.                         Case eMessages.ResuscitationSafeOff
  1099.                                 Call frmMain.ControlSM(eSMType.sResucitation, False)
  1100.          
  1101.                         Case eMessages.ResuscitationSafeOn
  1102.                                 Call frmMain.ControlSM(eSMType.sResucitation, True)
  1103.        
  1104.                         Case eMessages.NobilityLost
  1105.                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_PIERDE_NOBLEZA, 255, 0, 0, False, False, True)
  1106.        
  1107.                         Case eMessages.CantUseWhileMeditating
  1108.                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_USAR_MEDITANDO, 255, 0, 0, False, False, True)
  1109.        
  1110.                         Case eMessages.NPCHitUser
  1111.  
  1112.                                 Select Case incomingData.ReadByte()
  1113.  
  1114.                                         Case bCabeza
  1115.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_GOLPE_CABEZA & CStr(incomingData.ReadInteger()) & "!!", 255, 0, 0, True, False, True)
  1116.                
  1117.                                         Case bBrazoIzquierdo
  1118.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_GOLPE_BRAZO_IZQ & CStr(incomingData.ReadInteger()) & "!!", 255, 0, 0, True, False, True)
  1119.                
  1120.                                         Case bBrazoDerecho
  1121.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_GOLPE_BRAZO_DER & CStr(incomingData.ReadInteger()) & "!!", 255, 0, 0, True, False, True)
  1122.                
  1123.                                         Case bPiernaIzquierda
  1124.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_GOLPE_PIERNA_IZQ & CStr(incomingData.ReadInteger()) & "!!", 255, 0, 0, True, False, True)
  1125.                
  1126.                                         Case bPiernaDerecha
  1127.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_GOLPE_PIERNA_DER & CStr(incomingData.ReadInteger()) & "!!", 255, 0, 0, True, False, True)
  1128.                
  1129.                                         Case bTorso
  1130.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_GOLPE_TORSO & CStr(incomingData.ReadInteger() & "!!"), 255, 0, 0, True, False, True)
  1131.  
  1132.                                 End Select
  1133.        
  1134.                         Case eMessages.UserHitNPC
  1135.                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_GOLPE_CRIATURA_1 & CStr(incomingData.ReadLong()) & MENSAJE_2, 255, 0, 0, True, False, True)
  1136.        
  1137.                         Case eMessages.UserAttackedSwing
  1138.                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_1 & charlist(incomingData.ReadInteger()).Nombre & MENSAJE_ATAQUE_FALLO, 255, 0, 0, True, False, True)
  1139.        
  1140.                         Case eMessages.UserHittedByUser
  1141.  
  1142.                                 Dim AttackerName As String
  1143.            
  1144.                                 AttackerName = GetRawName(charlist(incomingData.ReadInteger()).Nombre)
  1145.                                 BodyPart = incomingData.ReadByte()
  1146.                                 Daño = incomingData.ReadInteger()
  1147.            
  1148.                                 Select Case BodyPart
  1149.  
  1150.                                         Case bCabeza
  1151.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_1 & AttackerName & MENSAJE_RECIVE_IMPACTO_CABEZA & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1152.                
  1153.                                         Case bBrazoIzquierdo
  1154.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_1 & AttackerName & MENSAJE_RECIVE_IMPACTO_BRAZO_IZQ & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1155.                
  1156.                                         Case bBrazoDerecho
  1157.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_1 & AttackerName & MENSAJE_RECIVE_IMPACTO_BRAZO_DER & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1158.                
  1159.                                         Case bPiernaIzquierda
  1160.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_1 & AttackerName & MENSAJE_RECIVE_IMPACTO_PIERNA_IZQ & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1161.                
  1162.                                         Case bPiernaDerecha
  1163.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_1 & AttackerName & MENSAJE_RECIVE_IMPACTO_PIERNA_DER & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1164.                
  1165.                                         Case bTorso
  1166.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_1 & AttackerName & MENSAJE_RECIVE_IMPACTO_TORSO & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1167.  
  1168.                                 End Select
  1169.        
  1170.                         Case eMessages.UserHittedUser
  1171.  
  1172.                                 Dim VictimName As String
  1173.            
  1174.                                 VictimName = GetRawName(charlist(incomingData.ReadInteger()).Nombre)
  1175.                                 BodyPart = incomingData.ReadByte()
  1176.                                 Daño = incomingData.ReadInteger()
  1177.            
  1178.                                 Select Case BodyPart
  1179.  
  1180.                                         Case bCabeza
  1181.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_PRODUCE_IMPACTO_1 & VictimName & MENSAJE_PRODUCE_IMPACTO_CABEZA & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1182.                
  1183.                                         Case bBrazoIzquierdo
  1184.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_PRODUCE_IMPACTO_1 & VictimName & MENSAJE_PRODUCE_IMPACTO_BRAZO_IZQ & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1185.                
  1186.                                         Case bBrazoDerecho
  1187.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_PRODUCE_IMPACTO_1 & VictimName & MENSAJE_PRODUCE_IMPACTO_BRAZO_DER & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1188.                
  1189.                                         Case bPiernaIzquierda
  1190.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_PRODUCE_IMPACTO_1 & VictimName & MENSAJE_PRODUCE_IMPACTO_PIERNA_IZQ & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1191.                
  1192.                                         Case bPiernaDerecha
  1193.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_PRODUCE_IMPACTO_1 & VictimName & MENSAJE_PRODUCE_IMPACTO_PIERNA_DER & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1194.                
  1195.                                         Case bTorso
  1196.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_PRODUCE_IMPACTO_1 & VictimName & MENSAJE_PRODUCE_IMPACTO_TORSO & Daño & MENSAJE_2, 255, 0, 0, True, False, True)
  1197.  
  1198.                                 End Select
  1199.        
  1200.                         Case eMessages.WorkRequestTarget
  1201.                                 UsingSkill = incomingData.ReadByte()
  1202.            
  1203.                                 frmMain.MousePointer = 2
  1204.            
  1205.                                 Select Case UsingSkill
  1206.  
  1207.                                         Case Magia
  1208.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_MAGIA, 100, 100, 120, 0, 0)
  1209.                
  1210.                                         Case Pesca
  1211.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_PESCA, 100, 100, 120, 0, 0)
  1212.                
  1213.                                         Case Robar
  1214.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_ROBAR, 100, 100, 120, 0, 0)
  1215.                
  1216.                                         Case Talar
  1217.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_TALAR, 100, 100, 120, 0, 0)
  1218.                
  1219.                                         Case Mineria
  1220.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_MINERIA, 100, 100, 120, 0, 0)
  1221.                
  1222.                                         Case FundirMetal
  1223.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_FUNDIRMETAL, 100, 100, 120, 0, 0)
  1224.                
  1225.                                         Case Proyectiles
  1226.                                                 Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_PROYECTILES, 100, 100, 120, 0, 0)
  1227.  
  1228.                                 End Select
  1229.  
  1230.                         Case eMessages.HaveKilledUser
  1231.  
  1232.                                 Dim KilledUser As Integer
  1233.  
  1234.                                 Dim Exp        As Long
  1235.            
  1236.                                 KilledUser = .ReadInteger
  1237.                                 Exp = .ReadLong
  1238.            
  1239.                                 Call ShowConsoleMsg(MENSAJE_HAS_MATADO_A & charlist(KilledUser).Nombre & MENSAJE_22, 255, 0, 0, True, False)
  1240.                                 Call ShowConsoleMsg(MENSAJE_HAS_GANADO_EXPE_1 & Exp & MENSAJE_HAS_GANADO_EXPE_2, 255, 0, 0, True, False)
  1241.            
  1242.                                 'Sacamos un screenshot si está activado el FragShooter:
  1243.                                If ClientSetup.bKill And ClientSetup.bActive Then
  1244.                                         If Exp \ 2 > ClientSetup.byMurderedLevel Then
  1245.                                                 FragShooterNickname = charlist(KilledUser).Nombre
  1246.                                                 FragShooterKilledSomeone = True
  1247.                    
  1248.                                                 FragShooterCapturePending = True
  1249.  
  1250.                                         End If
  1251.  
  1252.                                 End If
  1253.            
  1254.                         Case eMessages.UserKill
  1255.  
  1256.                                 Dim KillerUser As Integer
  1257.            
  1258.                                 KillerUser = .ReadInteger
  1259.            
  1260.                                 Call ShowConsoleMsg(charlist(KillerUser).Nombre & MENSAJE_TE_HA_MATADO, 255, 0, 0, True, False)
  1261.            
  1262.                                 'Sacamos un screenshot si está activado el FragShooter:
  1263.                                If ClientSetup.bDie And ClientSetup.bActive Then
  1264.                                         FragShooterNickname = charlist(KillerUser).Nombre
  1265.                                         FragShooterKilledSomeone = False
  1266.                
  1267.                                         FragShooterCapturePending = True
  1268.  
  1269.                                 End If
  1270.                
  1271.                         Case eMessages.EarnExp
  1272.                                 'Call ShowConsoleMsg(MENSAJE_HAS_GANADO_EXPE_1 & .ReadLong & MENSAJE_HAS_GANADO_EXPE_2, 255, 0, 0, True, False)
  1273.        
  1274.                         Case eMessages.GoHome
  1275.  
  1276.                                 Dim Distance As Byte
  1277.  
  1278.                                 Dim Hogar    As String
  1279.  
  1280.                                 Dim tiempo   As Integer
  1281.  
  1282.                                 Dim msg      As String
  1283.            
  1284.                                 Distance = .ReadByte
  1285.                                 tiempo = .ReadInteger
  1286.                                 Hogar = .ReadASCIIString
  1287.            
  1288.                                 If tiempo >= 60 Then
  1289.                                         If tiempo Mod 60 = 0 Then
  1290.                                                 msg = tiempo / 60 & " minutos."
  1291.                                         Else
  1292.                                                 msg = CInt(tiempo \ 60) & " minutos y " & tiempo Mod 60 & " segundos."  'Agregado el CInt() asi el número no es con , [C4b3z0n - 09/28/2010]
  1293.  
  1294.                                         End If
  1295.  
  1296.                                 Else
  1297.                                         msg = tiempo & " segundos."
  1298.  
  1299.                                 End If
  1300.            
  1301.                                 Call ShowConsoleMsg("Te encuentras a " & Distance & " mapas de la " & Hogar & ", este viaje durará " & msg, 255, 0, 0, True)
  1302.                                 Traveling = True
  1303.        
  1304.                         Case eMessages.FinishHome
  1305.                                 Call ShowConsoleMsg(MENSAJE_HOGAR, 255, 255, 255)
  1306.                                 Traveling = False
  1307.        
  1308.                         Case eMessages.CancelGoHome
  1309.                                 Call ShowConsoleMsg(MENSAJE_HOGAR_CANCEL, 255, 0, 0, True)
  1310.                                 Traveling = False
  1311.  
  1312.                 End Select
  1313.  
  1314.         End With
  1315.  
  1316. End Sub
  1317.  
  1318. ''
  1319. ' Handles the Logged message.
  1320.  
  1321. Private Sub HandleLogged()
  1322.         '***************************************************
  1323.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1324.        'Last Modification: 05/17/06
  1325.        '
  1326.        '***************************************************
  1327.        'Remove packet ID
  1328.        Call incomingData.ReadByte
  1329.    
  1330.         ' Variable initialization
  1331.        UserClase = incomingData.ReadByte
  1332.         EngineRun = True
  1333.         Nombres = True
  1334.         bRain = False
  1335.    
  1336.         'Set connected state
  1337.        Call SetConnected
  1338.  
  1339. End Sub
  1340.  
  1341. ''
  1342. ' Handles the RemoveDialogs message.
  1343.  
  1344. Private Sub HandleRemoveDialogs()
  1345.         '***************************************************
  1346.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1347.        'Last Modification: 05/17/06
  1348.        '
  1349.        '***************************************************
  1350.        'Remove packet ID
  1351.        Call incomingData.ReadByte
  1352.    
  1353.         Call Dialogos.RemoveAllDialogs
  1354.  
  1355. End Sub
  1356.  
  1357. ''
  1358. ' Handles the RemoveCharDialog message.
  1359.  
  1360. Private Sub HandleRemoveCharDialog()
  1361.  
  1362.         '***************************************************
  1363.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1364.        'Last Modification: 05/17/06
  1365.        '
  1366.        '***************************************************
  1367.        'Check if the packet is complete
  1368.        If incomingData.Length < 3 Then
  1369.                 Err.Raise incomingData.NotEnoughDataErrCode
  1370.                 Exit Sub
  1371.  
  1372.         End If
  1373.    
  1374.         'Remove packet ID
  1375.        Call incomingData.ReadByte
  1376.    
  1377.         Call Dialogos.RemoveDialog(incomingData.ReadInteger())
  1378.  
  1379. End Sub
  1380.  
  1381. ''
  1382. ' Handles the NavigateToggle message.
  1383.  
  1384. Private Sub HandleNavigateToggle()
  1385.         '***************************************************
  1386.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1387.        'Last Modification: 05/17/06
  1388.        '
  1389.        '***************************************************
  1390.        'Remove packet ID
  1391.        Call incomingData.ReadByte
  1392.    
  1393.         UserNavegando = Not UserNavegando
  1394.  
  1395. End Sub
  1396.  
  1397. ''
  1398. ' Handles the Disconnect message.
  1399.  
  1400. Private Sub HandleDisconnect()
  1401.  
  1402.         '***************************************************
  1403.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1404.        'Last Modification: 05/17/06
  1405.        '
  1406.        '***************************************************
  1407.  
  1408.         'Remove packet ID
  1409.        Call incomingData.ReadByte
  1410.    
  1411.         'Close connection
  1412.      
  1413.         frmMain.Socket1.Disconnect
  1414.  
  1415.         ResetAllInfo
  1416.  
  1417. End Sub
  1418.  
  1419. ''
  1420. ' Handles the CommerceEnd message.
  1421.  
  1422. Private Sub HandleCommerceEnd()
  1423.         '***************************************************
  1424.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1425.        'Last Modification: 05/17/06
  1426.        '
  1427.        '***************************************************
  1428.        'Remove packet ID
  1429.        Call incomingData.ReadByte
  1430.    
  1431.         Set InvComUsu = Nothing
  1432.         Set InvComNpc = Nothing
  1433.    
  1434.         'Hide form
  1435.        Unload frmComerciar
  1436.    
  1437.         'Reset vars
  1438.        Comerciando = False
  1439.  
  1440. End Sub
  1441.  
  1442. ''
  1443. ' Handles the BankEnd message.
  1444.  
  1445. Private Sub HandleBankEnd()
  1446.         '***************************************************
  1447.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1448.        'Last Modification: 05/17/06
  1449.        '
  1450.        '***************************************************
  1451.        'Remove packet ID
  1452.        Call incomingData.ReadByte
  1453.    
  1454.         Set InvBanco(0) = Nothing
  1455.         Set InvBanco(1) = Nothing
  1456.    
  1457.         Unload frmBancoObj
  1458.         Comerciando = False
  1459.  
  1460. End Sub
  1461.  
  1462. ''
  1463. ' Handles the CommerceInit message.
  1464.  
  1465. Private Sub HandleCommerceInit()
  1466.  
  1467.         '***************************************************
  1468.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1469.        'Last Modification: 05/17/06
  1470.        '
  1471.        '***************************************************
  1472.        Dim i As Long
  1473.    
  1474.         'Remove packet ID
  1475.        Call incomingData.ReadByte
  1476.    
  1477.         Set InvComUsu = New clsGrapchicalInventory
  1478.         Set InvComNpc = New clsGrapchicalInventory
  1479.    
  1480.         ' Initialize commerce inventories
  1481.        Call InvComUsu.Initialize(DirectDraw, frmComerciar.picInvUser, Inventario.MaxObjs)
  1482.         Call InvComNpc.Initialize(DirectDraw, frmComerciar.picInvNpc, MAX_NPC_INVENTORY_SLOTS)
  1483.  
  1484.         'Fill user inventory
  1485.        For i = 1 To MAX_INVENTORY_SLOTS
  1486.  
  1487.                 If Inventario.ObjIndex(i) <> 0 Then
  1488.  
  1489.                         With Inventario
  1490.                                 Call InvComUsu.SetItem(i, .ObjIndex(i), _
  1491.                                    .Amount(i), .Equipped(i), .GrhIndex(i), _
  1492.                                    .ObjType(i), .MaxHit(i), .MinHit(i), .MaxDef(i), .MinDef(i), _
  1493.                                    .Valor(i), .ItemName(i))
  1494.  
  1495.                         End With
  1496.  
  1497.                 End If
  1498.  
  1499.         Next i
  1500.    
  1501.         ' Fill Npc inventory
  1502.        For i = 1 To 50
  1503.  
  1504.                 If NPCInventory(i).ObjIndex <> 0 Then
  1505.  
  1506.                         With NPCInventory(i)
  1507.                                 Call InvComNpc.SetItem(i, .ObjIndex, _
  1508.                                    .Amount, 0, .GrhIndex, _
  1509.                                    .ObjType, .MaxHit, .MinHit, .MaxDef, .MinDef, _
  1510.                                    .Valor, .Name)
  1511.  
  1512.                         End With
  1513.  
  1514.                 End If
  1515.  
  1516.         Next i
  1517.    
  1518.         'Set state and show form
  1519.        Comerciando = True
  1520.         frmComerciar.Show , frmMain
  1521.  
  1522. End Sub
  1523.  
  1524. ''
  1525. ' Handles the BankInit message.
  1526.  
  1527. Private Sub HandleBankInit()
  1528.  
  1529.         '***************************************************
  1530.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1531.        'Last Modification: 05/17/06
  1532.        '
  1533.        '***************************************************
  1534.        Dim i        As Long
  1535.  
  1536.         Dim BankGold As Long
  1537.    
  1538.         'Remove packet ID
  1539.        Call incomingData.ReadByte
  1540.    
  1541.         Set InvBanco(0) = New clsGrapchicalInventory
  1542.         Set InvBanco(1) = New clsGrapchicalInventory
  1543.    
  1544.         BankGold = incomingData.ReadLong
  1545.         Call InvBanco(0).Initialize(DirectDraw, frmBancoObj.PicBancoInv, MAX_BANCOINVENTORY_SLOTS)
  1546.         Call InvBanco(1).Initialize(DirectDraw, frmBancoObj.PicInv, Inventario.MaxObjs)
  1547.    
  1548.         For i = 1 To Inventario.MaxObjs
  1549.  
  1550.                 With Inventario
  1551.                         Call InvBanco(1).SetItem(i, .ObjIndex(i), _
  1552.                            .Amount(i), .Equipped(i), .GrhIndex(i), _
  1553.                            .ObjType(i), .MaxHit(i), .MinHit(i), .MaxDef(i), .MinDef(i), _
  1554.                            .Valor(i), .ItemName(i))
  1555.  
  1556.                 End With
  1557.  
  1558.         Next i
  1559.    
  1560.         For i = 1 To MAX_BANCOINVENTORY_SLOTS
  1561.  
  1562.                 With UserBancoInventory(i)
  1563.                         Call InvBanco(0).SetItem(i, .ObjIndex, _
  1564.                            .Amount, .Equipped, .GrhIndex, _
  1565.                            .ObjType, .MaxHit, .MinHit, .MaxDef, .MinDef, _
  1566.                            .Valor, .Name)
  1567.  
  1568.                 End With
  1569.  
  1570.         Next i
  1571.    
  1572.         'Set state and show form
  1573.        Comerciando = True
  1574.    
  1575.         frmBancoObj.lblUserGld.Caption = BankGold
  1576.    
  1577.         frmBancoObj.Show , frmMain
  1578.  
  1579. End Sub
  1580.  
  1581. ''
  1582. ' Handles the UserCommerceInit message.
  1583.  
  1584. Private Sub HandleUserCommerceInit()
  1585.  
  1586.         '***************************************************
  1587.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1588.        'Last Modification: 05/17/06
  1589.        '
  1590.        '***************************************************
  1591.        Dim i As Long
  1592.    
  1593.         'Remove packet ID
  1594.        Call incomingData.ReadByte
  1595.    
  1596.         TradingUserName = incomingData.ReadASCIIString
  1597.    
  1598.         Set InvComUsu = New clsGrapchicalInventory
  1599.         Set InvOfferComUsu(0) = New clsGrapchicalInventory
  1600.         Set InvOfferComUsu(1) = New clsGrapchicalInventory
  1601.         Set InvOroComUsu(0) = New clsGrapchicalInventory
  1602.         Set InvOroComUsu(1) = New clsGrapchicalInventory
  1603.         Set InvOroComUsu(2) = New clsGrapchicalInventory
  1604.    
  1605.         ' Initialize commerce inventories
  1606.        Call InvComUsu.Initialize(DirectDraw, frmComerciarUsu.picInvComercio, Inventario.MaxObjs)
  1607.         Call InvOfferComUsu(0).Initialize(DirectDraw, frmComerciarUsu.picInvOfertaProp, INV_OFFER_SLOTS)
  1608.         Call InvOfferComUsu(1).Initialize(DirectDraw, frmComerciarUsu.picInvOfertaOtro, INV_OFFER_SLOTS)
  1609.         Call InvOroComUsu(0).Initialize(DirectDraw, frmComerciarUsu.picInvOroProp, INV_GOLD_SLOTS, , TilePixelWidth * 2, TilePixelHeight, TilePixelWidth / 2, , , , True)
  1610.         Call InvOroComUsu(1).Initialize(DirectDraw, frmComerciarUsu.picInvOroOfertaProp, INV_GOLD_SLOTS, , TilePixelWidth * 2, TilePixelHeight, TilePixelWidth / 2, , , , True)
  1611.         Call InvOroComUsu(2).Initialize(DirectDraw, frmComerciarUsu.picInvOroOfertaOtro, INV_GOLD_SLOTS, , TilePixelWidth * 2, TilePixelHeight, TilePixelWidth / 2, , , , True)
  1612.  
  1613.         'Fill user inventory
  1614.        For i = 1 To MAX_INVENTORY_SLOTS
  1615.  
  1616.                 If Inventario.ObjIndex(i) <> 0 Then
  1617.  
  1618.                         With Inventario
  1619.                                 Call InvComUsu.SetItem(i, .ObjIndex(i), _
  1620.                                    .Amount(i), .Equipped(i), .GrhIndex(i), _
  1621.                                    .ObjType(i), .MaxHit(i), .MinHit(i), .MaxDef(i), .MinDef(i), _
  1622.                                    .Valor(i), .ItemName(i))
  1623.  
  1624.                         End With
  1625.  
  1626.                 End If
  1627.  
  1628.         Next i
  1629.  
  1630.         ' Inventarios de oro
  1631.        Call InvOroComUsu(0).SetItem(1, ORO_INDEX, UserGLD, 0, ORO_GRH, 0, 0, 0, 0, 0, 0, "Oro")
  1632.         Call InvOroComUsu(1).SetItem(1, ORO_INDEX, 0, 0, ORO_GRH, 0, 0, 0, 0, 0, 0, "Oro")
  1633.         Call InvOroComUsu(2).SetItem(1, ORO_INDEX, 0, 0, ORO_GRH, 0, 0, 0, 0, 0, 0, "Oro")
  1634.  
  1635.         'Set state and show form
  1636.        Comerciando = True
  1637.         Call frmComerciarUsu.Show(vbModeless, frmMain)
  1638.  
  1639. End Sub
  1640.  
  1641. ''
  1642. ' Handles the UserCommerceEnd message.
  1643.  
  1644. Private Sub HandleUserCommerceEnd()
  1645.         '***************************************************
  1646.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1647.        'Last Modification: 05/17/06
  1648.        '
  1649.        '***************************************************
  1650.        'Remove packet ID
  1651.        Call incomingData.ReadByte
  1652.    
  1653.         Set InvComUsu = Nothing
  1654.         Set InvOroComUsu(0) = Nothing
  1655.         Set InvOroComUsu(1) = Nothing
  1656.         Set InvOroComUsu(2) = Nothing
  1657.         Set InvOfferComUsu(0) = Nothing
  1658.         Set InvOfferComUsu(1) = Nothing
  1659.    
  1660.         'Destroy the form and reset the state
  1661.        Unload frmComerciarUsu
  1662.         Comerciando = False
  1663.  
  1664. End Sub
  1665.  
  1666. ''
  1667. ' Handles the UserOfferConfirm message.
  1668. Private Sub HandleUserOfferConfirm()
  1669.         '***************************************************
  1670.        'Author: ZaMa
  1671.        'Last Modification: 14/12/2009
  1672.        '
  1673.        '***************************************************
  1674.        'Remove packet ID
  1675.        Call incomingData.ReadByte
  1676.    
  1677.         With frmComerciarUsu
  1678.                 ' Now he can accept the offer or reject it
  1679.                .HabilitarAceptarRechazar True
  1680.        
  1681.                 .PrintCommerceMsg TradingUserName & " ha confirmado su oferta!", FontTypeNames.FONTTYPE_CONSE
  1682.  
  1683.         End With
  1684.    
  1685. End Sub
  1686.  
  1687. ''
  1688. ' Handles the ShowBlacksmithForm message.
  1689.  
  1690. Private Sub HandleShowBlacksmithForm()
  1691.         '***************************************************
  1692.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1693.        'Last Modification: 05/17/06
  1694.        '
  1695.        '***************************************************
  1696.        'Remove packet ID
  1697.        Call incomingData.ReadByte
  1698.    
  1699.         If frmMain.macrotrabajo.Enabled And (MacroBltIndex > 0) Then
  1700.                 Call WriteCraftBlacksmith(MacroBltIndex)
  1701.         Else
  1702.                 frmHerrero.Show , frmMain
  1703.                 MirandoHerreria = True
  1704.  
  1705.         End If
  1706.  
  1707. End Sub
  1708.  
  1709. ''
  1710. ' Handles the ShowCarpenterForm message.
  1711.  
  1712. Private Sub HandleShowCarpenterForm()
  1713.         '***************************************************
  1714.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1715.        'Last Modification: 05/17/06
  1716.        '
  1717.        '***************************************************
  1718.        'Remove packet ID
  1719.        Call incomingData.ReadByte
  1720.    
  1721.         If frmMain.macrotrabajo.Enabled And (MacroBltIndex > 0) Then
  1722.                 Call WriteCraftCarpenter(MacroBltIndex)
  1723.         Else
  1724.                 frmCarp.Show , frmMain
  1725.                 MirandoCarpinteria = True
  1726.  
  1727.         End If
  1728.  
  1729. End Sub
  1730.  
  1731. ''
  1732. ' Handles the UpdateSta message.
  1733.  
  1734. Private Sub HandleUpdateSta()
  1735.         '***************************************************
  1736.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1737.        'Last Modification: 05/17/06
  1738.        '
  1739.        '***************************************************
  1740.        'Check packet is complete
  1741.  
  1742.         If incomingData.Length < 3 Then
  1743.                 Err.Raise incomingData.NotEnoughDataErrCode
  1744.  
  1745.                 Exit Sub
  1746.  
  1747.         End If
  1748.    
  1749.         'Remove packet ID
  1750.        Call incomingData.ReadByte
  1751.    
  1752.         'Get data and update form
  1753.        UserMinSTA = incomingData.ReadInteger()
  1754.    
  1755.         frmMain.lblEnergia = UserMinSTA & "/" & UserMaxSTA
  1756.    
  1757.         Dim bWidth As Byte
  1758.    
  1759.         bWidth = (((UserMinSTA / 100) / (UserMaxSTA / 100)) * 146)
  1760.    
  1761.         frmMain.shpEnergia.Width = bWidth
  1762.    
  1763. End Sub
  1764.  
  1765. ''
  1766. ' Handles the UpdateMana message.
  1767.  
  1768. Private Sub HandleUpdateMana()
  1769.         '***************************************************
  1770.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1771.        'Last Modification: 05/17/06
  1772.        '
  1773.        '***************************************************
  1774.        'Check packet is complete
  1775.  
  1776.         If incomingData.Length < 3 Then
  1777.                 Err.Raise incomingData.NotEnoughDataErrCode
  1778.  
  1779.                 Exit Sub
  1780.  
  1781.         End If
  1782.    
  1783.         'Remove packet ID
  1784.        Call incomingData.ReadByte
  1785.    
  1786.         'Get data and update form
  1787.        UserMinMAN = incomingData.ReadInteger()
  1788.    
  1789.         frmMain.lblMana = UserMinMAN & "/" & UserMaxMAN
  1790.        
  1791.         frmMain.shpMana.Width = (((UserMinMAN / 100) / (UserMaxMAN / 100)) * 146)
  1792.  
  1793. End Sub
  1794.  
  1795. ''
  1796. ' Handles the UpdateHP message.
  1797.  
  1798. Private Sub HandleUpdateHP()
  1799.         '***************************************************
  1800.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1801.        'Last Modification: 05/17/06
  1802.        '
  1803.        '***************************************************
  1804.        'Check packet is complete
  1805.  
  1806.         If incomingData.Length < 3 Then
  1807.                 Err.Raise incomingData.NotEnoughDataErrCode
  1808.  
  1809.                 Exit Sub
  1810.  
  1811.         End If
  1812.    
  1813.         'Remove packet ID
  1814.        Call incomingData.ReadByte
  1815.    
  1816.         'Get data and update form
  1817.        UserMinHP = incomingData.ReadInteger()
  1818.    
  1819.         Dim bWidth As Integer
  1820.    
  1821.         bWidth = (((UserMinHP / 100) / (UserMaxHP / 100)) * 100)
  1822.    
  1823.         frmMain.lblVida.Caption = UserMinHP & "/" & UserMaxHP
  1824.         frmMain.shpVida.Width = bWidth
  1825.    
  1826.         'Is the user alive??
  1827.  
  1828.         If UserMinHP = 0 Then
  1829.                 UserEstado = 1
  1830.  
  1831.                 If frmMain.TrainingMacro Then Call frmMain.DesactivarMacroHechizos
  1832.                 If frmMain.macrotrabajo Then Call frmMain.DesactivarMacroTrabajo
  1833.         Else
  1834.                 UserEstado = 0
  1835.  
  1836.         End If
  1837.  
  1838. End Sub
  1839.  
  1840. ''
  1841. ' Handles the UpdateGold message.
  1842.  
  1843. Private Sub HandleUpdateGold()
  1844.  
  1845.         '***************************************************
  1846.        'Autor: Juan Martín Sotuyo Dodero (Maraxus)
  1847.        'Last Modification: 09/21/10
  1848.        'Last Modified By: C4b3z0n
  1849.        '- 08/14/07: Tavo - Added GldLbl color variation depending on User Gold and Level
  1850.        '- 09/21/10: C4b3z0n - Modified color change of gold ONLY if the player's level is greater than 12 (NOT newbie).
  1851.        '***************************************************
  1852.        'Check packet is complete
  1853.        If incomingData.Length < 5 Then
  1854.                 Err.Raise incomingData.NotEnoughDataErrCode
  1855.                 Exit Sub
  1856.  
  1857.         End If
  1858.    
  1859.         'Remove packet ID
  1860.        Call incomingData.ReadByte
  1861.    
  1862.         'Get data and update form
  1863.        UserGLD = incomingData.ReadLong()
  1864.    
  1865.         If UserGLD >= CLng(UserLvl) * 10000 And UserLvl > 12 Then 'Si el nivel es mayor de 12, es decir, no es newbie.
  1866.                'Changes color
  1867.                frmMain.GldLbl.ForeColor = &HFF& 'Red
  1868.        Else
  1869.                 'Changes color
  1870.                frmMain.GldLbl.ForeColor = &HFFFF& 'Yellow
  1871.  
  1872.         End If
  1873.    
  1874.         frmMain.GldLbl.Caption = UserGLD
  1875.  
  1876. End Sub
  1877.  
  1878. ''
  1879. ' Handles the UpdateBankGold message.
  1880.  
  1881. Private Sub HandleUpdateBankGold()
  1882.  
  1883.         '***************************************************
  1884.        'Autor: ZaMa
  1885.        'Last Modification: 14/12/2009
  1886.        '
  1887.        '***************************************************
  1888.        'Check packet is complete
  1889.        If incomingData.Length < 5 Then
  1890.                 Err.Raise incomingData.NotEnoughDataErrCode
  1891.                 Exit Sub
  1892.  
  1893.         End If
  1894.    
  1895.         'Remove packet ID
  1896.        Call incomingData.ReadByte
  1897.    
  1898.         frmBancoObj.lblUserGld.Caption = incomingData.ReadLong
  1899.    
  1900. End Sub
  1901.  
  1902. ''
  1903. ' Handles the UpdateExp message.
  1904.  
  1905. Private Sub HandleUpdateExp()
  1906.  
  1907.         '***************************************************
  1908.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  1909.        'Last Modification: 05/17/06
  1910.        '
  1911.        '***************************************************
  1912.        'Check packet is complete
  1913.        If incomingData.Length < 5 Then
  1914.                 Err.Raise incomingData.NotEnoughDataErrCode
  1915.                 Exit Sub
  1916.  
  1917.         End If
  1918.    
  1919.         'Remove packet ID
  1920.        Call incomingData.ReadByte
  1921.    
  1922.         'Get data and update form
  1923.        UserExp = incomingData.ReadLong()
  1924.         frmMain.lblExp.Caption = UserExp & "/" & UserPasarNivel
  1925.         frmMain.lblPorcLvl.Caption = "[" & Round(CDbl(UserExp) * CDbl(100) / CDbl(UserPasarNivel), 2) & "%]"
  1926.  
  1927. End Sub
  1928.  
  1929. ''
  1930. ' Handles the UpdateStrenghtAndDexterity message.
  1931.  
  1932. Private Sub HandleUpdateStrenghtAndDexterity()
  1933.  
  1934.         '***************************************************
  1935.        'Author: Budi
  1936.        'Last Modification: 11/26/09
  1937.        '***************************************************
  1938.        'Check packet is complete
  1939.        If incomingData.Length < 3 Then
  1940.                 Err.Raise incomingData.NotEnoughDataErrCode
  1941.                 Exit Sub
  1942.  
  1943.         End If
  1944.    
  1945.         'Remove packet ID
  1946.        Call incomingData.ReadByte
  1947.    
  1948.         'Get data and update form
  1949.        UserFuerza = incomingData.ReadByte
  1950.         UserAgilidad = incomingData.ReadByte
  1951.         frmMain.lblStrg.Caption = UserFuerza
  1952.         frmMain.lblDext.Caption = UserAgilidad
  1953.    
  1954.         frmMain.tmrBlink.Enabled = False
  1955.    
  1956.         frmMain.lblStrg.ForeColor = getStrenghtColor(UserFuerza)
  1957.         frmMain.lblDext.ForeColor = getDexterityColor(UserAgilidad)
  1958.  
  1959. End Sub
  1960.  
  1961. ' Handles the UpdateStrenghtAndDexterity message.
  1962.  
  1963. Private Sub HandleUpdateStrenght()
  1964.  
  1965.         '***************************************************
  1966.        'Author: Budi
  1967.        'Last Modification: 11/26/09
  1968.        '***************************************************
  1969.        'Check packet is complete
  1970.        If incomingData.Length < 2 Then
  1971.                 Err.Raise incomingData.NotEnoughDataErrCode
  1972.                 Exit Sub
  1973.  
  1974.         End If
  1975.    
  1976.         'Remove packet ID
  1977.        Call incomingData.ReadByte
  1978.    
  1979.         'Get data and update form
  1980.        UserFuerza = incomingData.ReadByte
  1981.         frmMain.lblStrg.Caption = UserFuerza
  1982.         frmMain.lblStrg.ForeColor = getStrenghtColor(UserFuerza)
  1983.         frmMain.tmrBlink.Enabled = False
  1984.  
  1985. End Sub
  1986.  
  1987. ' Handles the UpdateStrenghtAndDexterity message.
  1988.  
  1989. Private Sub HandleUpdateDexterity()
  1990.  
  1991.         '***************************************************
  1992.        'Author: Budi
  1993.        'Last Modification: 11/26/09
  1994.        '***************************************************
  1995.        'Check packet is complete
  1996.        If incomingData.Length < 2 Then
  1997.                 Err.Raise incomingData.NotEnoughDataErrCode
  1998.                 Exit Sub
  1999.  
  2000.         End If
  2001.    
  2002.         'Remove packet ID
  2003.        Call incomingData.ReadByte
  2004.    
  2005.         'Get data and update form
  2006.        UserAgilidad = incomingData.ReadByte
  2007.         frmMain.lblDext.Caption = UserAgilidad
  2008.         frmMain.lblDext.ForeColor = getDexterityColor(UserAgilidad)
  2009.         frmMain.tmrBlink.Enabled = False
  2010.  
  2011. End Sub
  2012.  
  2013. ''
  2014. ' Handles the ChangeMap message.
  2015. Private Sub HandleChangeMap()
  2016.  
  2017.         '***************************************************
  2018.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2019.        'Last Modification: 05/17/06
  2020.        '
  2021.        '***************************************************
  2022.        If incomingData.Length < 5 Then
  2023.                 Err.Raise incomingData.NotEnoughDataErrCode
  2024.                 Exit Sub
  2025.  
  2026.         End If
  2027.    
  2028.         'Remove packet ID
  2029.        Call incomingData.ReadByte
  2030.    
  2031.         UserMap = incomingData.ReadInteger()
  2032.    
  2033.         'TODO: Once on-the-fly editor is implemented check for map version before loading....
  2034.        'For now we just drop it
  2035.        Call incomingData.ReadInteger
  2036.            
  2037.         If FileExist(DirMapas & "Mapa" & UserMap & ".map", vbNormal) Then
  2038.                 Call SwitchMap(UserMap)
  2039.  
  2040.                 If bLluvia(UserMap) = 0 Then
  2041.                         If bRain Then
  2042.                                 Call Audio.StopWave(RainBufferIndex)
  2043.                                 RainBufferIndex = 0
  2044.                                 frmMain.IsPlaying = PlayLoop.plNone
  2045.  
  2046.                         End If
  2047.  
  2048.                 End If
  2049.  
  2050.         Else
  2051.                 'no encontramos el mapa en el hd
  2052.                MsgBox "Error en los mapas, algún archivo ha sido modificado o esta dañado."
  2053.        
  2054.                 Call CloseClient
  2055.  
  2056.         End If
  2057.  
  2058. End Sub
  2059.  
  2060. ''
  2061. ' Handles the PosUpdate message.
  2062.  
  2063. Private Sub HandlePosUpdate()
  2064.  
  2065.         '***************************************************
  2066.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2067.        'Last Modification: 05/17/06
  2068.        '
  2069.        '***************************************************
  2070.        If incomingData.Length < 3 Then
  2071.                 Err.Raise incomingData.NotEnoughDataErrCode
  2072.                 Exit Sub
  2073.  
  2074.         End If
  2075.    
  2076.         'Remove packet ID
  2077.        Call incomingData.ReadByte
  2078.    
  2079.         'Remove char from old position
  2080.        If MapData(UserPos.x, UserPos.y).CharIndex = UserCharIndex Then
  2081.                 MapData(UserPos.x, UserPos.y).CharIndex = 0
  2082.  
  2083.         End If
  2084.    
  2085.         'Set new pos
  2086.        UserPos.x = incomingData.ReadByte()
  2087.         UserPos.y = incomingData.ReadByte()
  2088.    
  2089.         'Set char
  2090.        MapData(UserPos.x, UserPos.y).CharIndex = UserCharIndex
  2091.         charlist(UserCharIndex).Pos = UserPos
  2092.    
  2093.         'Are we under a roof?
  2094.        bTecho = IIf(MapData(UserPos.x, UserPos.y).Trigger = 1 Or _
  2095.            MapData(UserPos.x, UserPos.y).Trigger = 2 Or _
  2096.            MapData(UserPos.x, UserPos.y).Trigger = 4, True, False)
  2097.                
  2098.         'Update pos label
  2099.        frmMain.Coord.Caption = UserMap & " X: " & UserPos.x & " Y: " & UserPos.y
  2100.  
  2101. End Sub
  2102.  
  2103. ''
  2104. ' Handles the ChatOverHead message.
  2105.  
  2106. Private Sub HandleChatOverHead()
  2107.  
  2108.         '***************************************************
  2109.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2110.        'Last Modification: 05/17/06
  2111.        '
  2112.        '***************************************************
  2113.        If incomingData.Length < 8 Then
  2114.                 Err.Raise incomingData.NotEnoughDataErrCode
  2115.                 Exit Sub
  2116.  
  2117.         End If
  2118.    
  2119.         On Error GoTo ErrHandler
  2120.  
  2121.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  2122.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  2123.  
  2124.         Call Buffer.CopyBuffer(incomingData)
  2125.    
  2126.         'Remove packet ID
  2127.        Call Buffer.ReadByte
  2128.    
  2129.         Dim chat      As String
  2130.  
  2131.         Dim CharIndex As Integer
  2132.  
  2133.         Dim r         As Byte
  2134.  
  2135.         Dim g         As Byte
  2136.  
  2137.         Dim B         As Byte
  2138.    
  2139.         chat = Buffer.ReadASCIIString()
  2140.         CharIndex = Buffer.ReadInteger()
  2141.    
  2142.         r = Buffer.ReadByte()
  2143.         g = Buffer.ReadByte()
  2144.         B = Buffer.ReadByte()
  2145.    
  2146.         'Only add the chat if the character exists (a CharacterRemove may have been sent to the PC / NPC area before the buffer was flushed)
  2147.        If charlist(CharIndex).Active Then _
  2148.            Call Dialogos.CreateDialog(Trim$(chat), CharIndex, RGB(r, g, B))
  2149.    
  2150.         'If we got here then packet is complete, copy data back to original queue
  2151.        Call incomingData.CopyBuffer(Buffer)
  2152.  
  2153. ErrHandler:
  2154.  
  2155.         Dim error As Long
  2156.  
  2157.         error = Err.number
  2158.  
  2159.         On Error GoTo 0
  2160.    
  2161.         'Destroy auxiliar buffer
  2162.        Set Buffer = Nothing
  2163.    
  2164.         If error <> 0 Then _
  2165.            Err.Raise error
  2166.  
  2167. End Sub
  2168.  
  2169. Private Sub HandleConsoleMessage()
  2170.  
  2171.         '***************************************************
  2172.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2173.        'Last Modification: 12/05/11
  2174.        'D'Artagnan: Agrego la división de consolas
  2175.        '***************************************************
  2176.        If incomingData.Length < 3 Then
  2177.                 Err.Raise incomingData.NotEnoughDataErrCode
  2178.                 Exit Sub
  2179.  
  2180.         End If
  2181.    
  2182.         On Error GoTo ErrHandler
  2183.  
  2184.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  2185.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  2186.  
  2187.         Call Buffer.CopyBuffer(incomingData)
  2188.    
  2189.         'Remove packet ID
  2190.        Call Buffer.ReadByte
  2191.    
  2192.         Dim chat      As String
  2193.  
  2194.         Dim FontIndex As Integer
  2195.  
  2196.         Dim str       As String
  2197.  
  2198.         Dim r         As Byte
  2199.  
  2200.         Dim g         As Byte
  2201.  
  2202.         Dim B         As Byte
  2203.    
  2204.         chat = Buffer.ReadASCIIString()
  2205.         FontIndex = Buffer.ReadByte()
  2206.  
  2207.         If InStr(1, chat, "~") Then
  2208.                 str = ReadField(2, chat, 126)
  2209.  
  2210.                 If Val(str) > 255 Then
  2211.                         r = 255
  2212.                 Else
  2213.                         r = Val(str)
  2214.  
  2215.                 End If
  2216.            
  2217.                 str = ReadField(3, chat, 126)
  2218.  
  2219.                 If Val(str) > 255 Then
  2220.                         g = 255
  2221.                 Else
  2222.                         g = Val(str)
  2223.  
  2224.                 End If
  2225.            
  2226.                 str = ReadField(4, chat, 126)
  2227.  
  2228.                 If Val(str) > 255 Then
  2229.                         B = 255
  2230.                 Else
  2231.                         B = Val(str)
  2232.  
  2233.                 End If
  2234.  
  2235.                 Call AddtoRichTextBox(frmMain.RecTxt, Left$(chat, InStr(1, chat, "~") - 1), r, g, B, Val(ReadField(5, chat, 126)) <> 0, Val(ReadField(6, chat, 126)) <> 0)
  2236.        
  2237.         Else
  2238.  
  2239.                 If FontIndex = FontTypeNames.FONTTYPE_PARTY Then 'CHOTS | Mensajes personalizados de Party
  2240.                    
  2241.                         With FontTypes(FontIndex)
  2242.                                 Call AddtoRichTextBox(frmMain.RecTxt, chat, .red, .green, .blue, .Bold, .Italic)
  2243.  
  2244.                         End With
  2245.  
  2246.                 Else
  2247.  
  2248.                         With FontTypes(FontIndex)
  2249.                                 Call AddtoRichTextBox(frmMain.RecTxt, chat, .red, .green, .blue, .Bold, .Italic)
  2250.  
  2251.                         End With
  2252.  
  2253.                 End If
  2254.        
  2255.                 ' Para no perder el foco cuando chatea por party
  2256.                If FontIndex = FontTypeNames.FONTTYPE_PARTY Then
  2257.                         If MirandoParty Then frmParty.SendTxt.SetFocus
  2258.  
  2259.                 End If
  2260.  
  2261.         End If
  2262.  
  2263.         '    Call checkText(chat)
  2264.        'If we got here then packet is complete, copy data back to original queue
  2265.        Call incomingData.CopyBuffer(Buffer)
  2266.    
  2267. ErrHandler:
  2268.  
  2269.         Dim error As Long
  2270.  
  2271.         error = Err.number
  2272.  
  2273.         On Error GoTo 0
  2274.    
  2275.         'Destroy auxiliar buffer
  2276.        Set Buffer = Nothing
  2277.  
  2278.         If error <> 0 Then _
  2279.            Err.Raise error
  2280.  
  2281. End Sub
  2282.  
  2283. ''
  2284. ' Handles the GuildChat message.
  2285.  
  2286. Private Sub HandleGuildChat()
  2287.  
  2288.         '***************************************************
  2289.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2290.        'Last Modification: 12/05/11 (D'Artagnan)
  2291.        'Redirect messages to guild console
  2292.        '***************************************************
  2293.        If incomingData.Length < 3 Then
  2294.                 Err.Raise incomingData.NotEnoughDataErrCode
  2295.                 Exit Sub
  2296.  
  2297.         End If
  2298.    
  2299.         On Error GoTo ErrHandler
  2300.  
  2301.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  2302.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  2303.  
  2304.         Call Buffer.CopyBuffer(incomingData)
  2305.    
  2306.         'Remove packet ID
  2307.        Call Buffer.ReadByte
  2308.    
  2309.         Dim chat   As String
  2310.  
  2311.         Dim IsMOTD As Boolean
  2312.  
  2313.         Dim str    As String
  2314.  
  2315.         Dim r      As Byte
  2316.  
  2317.         Dim g      As Byte
  2318.  
  2319.         Dim B      As Byte
  2320.    
  2321.         chat = Buffer.ReadASCIIString()
  2322.         IsMOTD = Buffer.ReadBoolean()
  2323.    
  2324.         If Not DialogosClanes.Activo Then
  2325.                 If InStr(1, chat, "~") Then
  2326.                         str = ReadField(2, chat, 126)
  2327.  
  2328.                         If Val(str) > 255 Then
  2329.                                 r = 255
  2330.                         Else
  2331.                                 r = Val(str)
  2332.  
  2333.                         End If
  2334.            
  2335.                         str = ReadField(3, chat, 126)
  2336.  
  2337.                         If Val(str) > 255 Then
  2338.                                 g = 255
  2339.                         Else
  2340.                                 g = Val(str)
  2341.  
  2342.                         End If
  2343.            
  2344.                         str = ReadField(4, chat, 126)
  2345.  
  2346.                         If Val(str) > 255 Then
  2347.                                 B = 255
  2348.                         Else
  2349.                                 B = Val(str)
  2350.  
  2351.                         End If
  2352.            
  2353.                         If IsMOTD = True Then
  2354.                                 Call AddtoRichTextBox(frmMain.RecTxt, Left$(chat, InStr(1, chat, "~") - 1), r, g, B, Val(ReadField(5, chat, 126)) <> 0, Val(ReadField(6, chat, 126)) <> 0)
  2355.                         Else
  2356.                                 Call AddtoRichTextBox(frmMain.RecTxt, Left$(chat, InStr(1, chat, "~") - 1), r, g, B, Val(ReadField(5, chat, 126)) <> 0, Val(ReadField(6, chat, 126)) <> 0)
  2357.  
  2358.                         End If
  2359.  
  2360.                 Else
  2361.  
  2362.                         With FontTypes(FontTypeNames.FONTTYPE_GUILDMSG)
  2363.  
  2364.                                 If IsMOTD = True Then
  2365.                                         Call AddtoRichTextBox(frmMain.RecTxt, chat, .red, .green, .blue, .Bold, .Italic)
  2366.                                 Else
  2367.                                         Call AddtoRichTextBox(frmMain.RecTxt, chat, .red, .green, .blue, .Bold, .Italic)
  2368.  
  2369.                                 End If
  2370.  
  2371.                         End With
  2372.  
  2373.                 End If
  2374.  
  2375.         Else
  2376.                 Call DialogosClanes.PushBackText(ReadField(1, chat, 126))
  2377.  
  2378.         End If
  2379.    
  2380.         'If we got here then packet is complete, copy data back to original queue
  2381.        Call incomingData.CopyBuffer(Buffer)
  2382.    
  2383. ErrHandler:
  2384.  
  2385.         Dim error As Long
  2386.  
  2387.         error = Err.number
  2388.  
  2389.         On Error GoTo 0
  2390.    
  2391.         'Destroy auxiliar buffer
  2392.        Set Buffer = Nothing
  2393.  
  2394.         If error <> 0 Then _
  2395.            Err.Raise error
  2396.  
  2397. End Sub
  2398.  
  2399. ''
  2400. ' Handles the ConsoleMessage message.
  2401.  
  2402. Private Sub HandleCommerceChat()
  2403.  
  2404.         '***************************************************
  2405.        'Author: ZaMa
  2406.        'Last Modification: 03/12/2009
  2407.        '
  2408.        '***************************************************
  2409.        If incomingData.Length < 4 Then
  2410.                 Err.Raise incomingData.NotEnoughDataErrCode
  2411.                 Exit Sub
  2412.  
  2413.         End If
  2414.    
  2415.         On Error GoTo ErrHandler
  2416.  
  2417.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  2418.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  2419.  
  2420.         Call Buffer.CopyBuffer(incomingData)
  2421.    
  2422.         'Remove packet ID
  2423.        Call Buffer.ReadByte
  2424.    
  2425.         Dim chat      As String
  2426.  
  2427.         Dim FontIndex As Integer
  2428.  
  2429.         Dim str       As String
  2430.  
  2431.         Dim r         As Byte
  2432.  
  2433.         Dim g         As Byte
  2434.  
  2435.         Dim B         As Byte
  2436.    
  2437.         chat = Buffer.ReadASCIIString()
  2438.         FontIndex = Buffer.ReadByte()
  2439.    
  2440.         If InStr(1, chat, "~") Then
  2441.                 str = ReadField(2, chat, 126)
  2442.  
  2443.                 If Val(str) > 255 Then
  2444.                         r = 255
  2445.                 Else
  2446.                         r = Val(str)
  2447.  
  2448.                 End If
  2449.            
  2450.                 str = ReadField(3, chat, 126)
  2451.  
  2452.                 If Val(str) > 255 Then
  2453.                         g = 255
  2454.                 Else
  2455.                         g = Val(str)
  2456.  
  2457.                 End If
  2458.            
  2459.                 str = ReadField(4, chat, 126)
  2460.  
  2461.                 If Val(str) > 255 Then
  2462.                         B = 255
  2463.                 Else
  2464.                         B = Val(str)
  2465.  
  2466.                 End If
  2467.            
  2468.                 Call AddtoRichTextBox(frmComerciarUsu.CommerceConsole, Left$(chat, InStr(1, chat, "~") - 1), r, g, B, Val(ReadField(5, chat, 126)) <> 0, Val(ReadField(6, chat, 126)) <> 0)
  2469.         Else
  2470.  
  2471.                 With FontTypes(FontIndex)
  2472.                         Call AddtoRichTextBox(frmComerciarUsu.CommerceConsole, chat, .red, .green, .blue, .Bold, .Italic)
  2473.  
  2474.                 End With
  2475.  
  2476.         End If
  2477.    
  2478.         'If we got here then packet is complete, copy data back to original queue
  2479.        Call incomingData.CopyBuffer(Buffer)
  2480.    
  2481. ErrHandler:
  2482.  
  2483.         Dim error As Long
  2484.  
  2485.         error = Err.number
  2486.  
  2487.         On Error GoTo 0
  2488.    
  2489.         'Destroy auxiliar buffer
  2490.        Set Buffer = Nothing
  2491.  
  2492.         If error <> 0 Then _
  2493.            Err.Raise error
  2494.  
  2495. End Sub
  2496.  
  2497. ''
  2498. ' Handles the ShowMessageBox message.
  2499.  
  2500. Private Sub HandleShowMessageBox()
  2501.  
  2502.         '***************************************************
  2503.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2504.        'Last Modification: 05/17/06
  2505.        '
  2506.        '***************************************************
  2507.        If incomingData.Length < 3 Then
  2508.                 Err.Raise incomingData.NotEnoughDataErrCode
  2509.                 Exit Sub
  2510.  
  2511.         End If
  2512.    
  2513.         On Error GoTo ErrHandler
  2514.  
  2515.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  2516.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  2517.  
  2518.         Call Buffer.CopyBuffer(incomingData)
  2519.    
  2520.         'Remove packet ID
  2521.        Call Buffer.ReadByte
  2522.    
  2523.         frmMensaje.msg.Caption = Buffer.ReadASCIIString()
  2524.         frmMensaje.Show
  2525.    
  2526.         'If we got here then packet is complete, copy data back to original queue
  2527.        Call incomingData.CopyBuffer(Buffer)
  2528.    
  2529. ErrHandler:
  2530.  
  2531.         Dim error As Long
  2532.  
  2533.         error = Err.number
  2534.  
  2535.         On Error GoTo 0
  2536.    
  2537.         'Destroy auxiliar buffer
  2538.        Set Buffer = Nothing
  2539.  
  2540.         If error <> 0 Then _
  2541.            Err.Raise error
  2542.  
  2543. End Sub
  2544.  
  2545. ''
  2546. ' Handles the UserIndexInServer message.
  2547.  
  2548. Private Sub HandleUserIndexInServer()
  2549.  
  2550.         '***************************************************
  2551.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2552.        'Last Modification: 05/17/06
  2553.        '
  2554.        '***************************************************
  2555.        If incomingData.Length < 3 Then
  2556.                 Err.Raise incomingData.NotEnoughDataErrCode
  2557.                 Exit Sub
  2558.  
  2559.         End If
  2560.    
  2561.         'Remove packet ID
  2562.        Call incomingData.ReadByte
  2563.    
  2564.         UserIndex = incomingData.ReadInteger()
  2565.  
  2566. End Sub
  2567.  
  2568. ''
  2569. ' Handles the UserCharIndexInServer message.
  2570.  
  2571. Private Sub HandleUserCharIndexInServer()
  2572.  
  2573.         '***************************************************
  2574.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2575.        'Last Modification: 05/17/06
  2576.        '
  2577.        '***************************************************
  2578.        If incomingData.Length < 3 Then
  2579.                 Err.Raise incomingData.NotEnoughDataErrCode
  2580.                 Exit Sub
  2581.  
  2582.         End If
  2583.    
  2584.         'Remove packet ID
  2585.        Call incomingData.ReadByte
  2586.    
  2587.         UserCharIndex = incomingData.ReadInteger()
  2588.         UserPos = charlist(UserCharIndex).Pos
  2589.    
  2590.         'Are we under a roof?
  2591.        bTecho = IIf(MapData(UserPos.x, UserPos.y).Trigger = 1 Or _
  2592.            MapData(UserPos.x, UserPos.y).Trigger = 2 Or _
  2593.            MapData(UserPos.x, UserPos.y).Trigger = 4, True, False)
  2594.  
  2595.         frmMain.Coord.Caption = UserMap & " X: " & UserPos.x & " Y: " & UserPos.y
  2596.  
  2597. End Sub
  2598.  
  2599. ''
  2600. ' Handles the CharacterCreate message.
  2601.  
  2602. Private Sub HandleCharacterCreate()
  2603.  
  2604.         '***************************************************
  2605.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2606.        'Last Modification: 05/17/06
  2607.        '
  2608.        '***************************************************
  2609.        If incomingData.Length < 24 Then
  2610.                 Err.Raise incomingData.NotEnoughDataErrCode
  2611.                 Exit Sub
  2612.  
  2613.         End If
  2614.    
  2615.         On Error GoTo ErrHandler
  2616.  
  2617.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  2618.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  2619.  
  2620.         Call Buffer.CopyBuffer(incomingData)
  2621.    
  2622.         'Remove packet ID
  2623.        Call Buffer.ReadByte
  2624.    
  2625.         Dim CharIndex As Integer
  2626.  
  2627.         Dim Body      As Integer
  2628.  
  2629.         Dim Head      As Integer
  2630.  
  2631.         Dim Heading   As E_Heading
  2632.  
  2633.         Dim x         As Byte
  2634.  
  2635.         Dim y         As Byte
  2636.  
  2637.         Dim weapon    As Integer
  2638.  
  2639.         Dim shield    As Integer
  2640.  
  2641.         Dim helmet    As Integer
  2642.  
  2643.         Dim privs     As Integer
  2644.  
  2645.         Dim NickColor As Byte
  2646.    
  2647.         CharIndex = Buffer.ReadInteger()
  2648.         Body = Buffer.ReadInteger()
  2649.         Head = Buffer.ReadInteger()
  2650.         Heading = Buffer.ReadByte()
  2651.         x = Buffer.ReadByte()
  2652.         y = Buffer.ReadByte()
  2653.         weapon = Buffer.ReadInteger()
  2654.         shield = Buffer.ReadInteger()
  2655.         helmet = Buffer.ReadInteger()
  2656.    
  2657.         With charlist(CharIndex)
  2658.                 Call SetCharacterFx(CharIndex, Buffer.ReadInteger(), Buffer.ReadInteger())
  2659.        
  2660.                 .Nombre = Buffer.ReadASCIIString()
  2661.                 NickColor = Buffer.ReadByte()
  2662.        
  2663.                 If (NickColor And eNickColor.ieCriminal) <> 0 Then
  2664.                         .Criminal = 1
  2665.                 Else
  2666.                         .Criminal = 0
  2667.  
  2668.                 End If
  2669.        
  2670.                 .Atacable = (NickColor And eNickColor.ieAtacable) <> 0
  2671.        
  2672.                 privs = Buffer.ReadByte()
  2673.                
  2674.                 .Min_HP = Buffer.ReadLong()
  2675.                 .Max_Hp = Buffer.ReadLong()
  2676.        
  2677.                 If privs <> 0 Then
  2678.  
  2679.                         'If the player belongs to a council AND is an admin, only whos as an admin
  2680.                        If (privs And PlayerType.ChaosCouncil) <> 0 And (privs And PlayerType.User) = 0 Then
  2681.                                 privs = privs Xor PlayerType.ChaosCouncil
  2682.  
  2683.                         End If
  2684.            
  2685.                         If (privs And PlayerType.RoyalCouncil) <> 0 And (privs And PlayerType.User) = 0 Then
  2686.                                 privs = privs Xor PlayerType.RoyalCouncil
  2687.  
  2688.                         End If
  2689.            
  2690.                         'If the player is a RM, ignore other flags
  2691.                        If privs And PlayerType.RoleMaster Then
  2692.                                 privs = PlayerType.RoleMaster
  2693.  
  2694.                         End If
  2695.            
  2696.                         'Log2 of the bit flags sent by the server gives our numbers ^^
  2697.                        .priv = Log(privs) / Log(2)
  2698.                 Else
  2699.                         .priv = 0
  2700.  
  2701.                 End If
  2702.  
  2703.         End With
  2704.    
  2705.         Call MakeChar(CharIndex, Body, Head, Heading, x, y, weapon, shield, helmet)
  2706.    
  2707.         Call RefreshAllChars
  2708.    
  2709.         'If we got here then packet is complete, copy data back to original queue
  2710.        Call incomingData.CopyBuffer(Buffer)
  2711.    
  2712. ErrHandler:
  2713.  
  2714.         Dim error As Long
  2715.  
  2716.         error = Err.number
  2717.  
  2718.         On Error GoTo 0
  2719.    
  2720.         'Destroy auxiliar buffer
  2721.        Set Buffer = Nothing
  2722.  
  2723.         If error <> 0 Then _
  2724.            Err.Raise error
  2725.  
  2726. End Sub
  2727.  
  2728. Private Sub HandleCharacterChangeNick()
  2729.  
  2730.         '***************************************************
  2731.        'Author: Budi
  2732.        'Last Modification: 07/23/09
  2733.        '
  2734.        '***************************************************
  2735.        If incomingData.Length < 6 Then
  2736.                 Err.Raise incomingData.NotEnoughDataErrCode
  2737.                 Exit Sub
  2738.  
  2739.         End If
  2740.    
  2741.         'Remove packet id
  2742.        Call incomingData.ReadByte
  2743.  
  2744.         Dim CharIndex As Integer
  2745.  
  2746.         CharIndex = incomingData.ReadInteger
  2747.         charlist(CharIndex).Nombre = incomingData.ReadASCIIString
  2748.    
  2749. End Sub
  2750.  
  2751. ''
  2752. ' Handles the CharacterRemove message.
  2753.  
  2754. Private Sub HandleCharacterRemove()
  2755.  
  2756.         '***************************************************
  2757.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2758.        'Last Modification: 05/17/06
  2759.        '
  2760.        '***************************************************
  2761.        If incomingData.Length < 3 Then
  2762.                 Err.Raise incomingData.NotEnoughDataErrCode
  2763.                 Exit Sub
  2764.  
  2765.         End If
  2766.    
  2767.         'Remove packet ID
  2768.        Call incomingData.ReadByte
  2769.    
  2770.         Dim CharIndex As Integer
  2771.    
  2772.         CharIndex = incomingData.ReadInteger()
  2773.    
  2774.         Call EraseChar(CharIndex)
  2775.         Call RefreshAllChars
  2776.  
  2777. End Sub
  2778.  
  2779. ''
  2780. ' Handles the CharacterMove message.
  2781.  
  2782. Private Sub HandleCharacterMove()
  2783.  
  2784.         '***************************************************
  2785.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2786.        'Last Modification: 05/17/06
  2787.        '
  2788.        '***************************************************
  2789.        If incomingData.Length < 5 Then
  2790.                 Err.Raise incomingData.NotEnoughDataErrCode
  2791.                 Exit Sub
  2792.  
  2793.         End If
  2794.    
  2795.         'Remove packet ID
  2796.        Call incomingData.ReadByte
  2797.    
  2798.         Dim CharIndex As Integer
  2799.  
  2800.         Dim x         As Byte
  2801.  
  2802.         Dim y         As Byte
  2803.    
  2804.         CharIndex = incomingData.ReadInteger()
  2805.         x = incomingData.ReadByte()
  2806.         y = incomingData.ReadByte()
  2807.    
  2808.         With charlist(CharIndex)
  2809.  
  2810.                 If .FxIndex >= 40 And .FxIndex <= 49 Then   'If it's meditating, we remove the FX
  2811.                        .FxIndex = 0
  2812.  
  2813.                 End If
  2814.        
  2815.                 ' Play steps sounds if the user is not an admin of any kind
  2816.                If .priv <> 1 And .priv <> 2 And .priv <> 3 And .priv <> 5 And .priv <> 25 Then
  2817.                         Call DoPasosFx(CharIndex)
  2818.  
  2819.                 End If
  2820.  
  2821.         End With
  2822.    
  2823.         Call MoveCharbyPos(CharIndex, x, y)
  2824.    
  2825.         Call RefreshAllChars
  2826.  
  2827. End Sub
  2828.  
  2829. ''
  2830. ' Handles the ForceCharMove message.
  2831.  
  2832. Private Sub HandleForceCharMove()
  2833.    
  2834.         If incomingData.Length < 2 Then
  2835.                 Err.Raise incomingData.NotEnoughDataErrCode
  2836.                 Exit Sub
  2837.  
  2838.         End If
  2839.    
  2840.         'Remove packet ID
  2841.        Call incomingData.ReadByte
  2842.    
  2843.         Dim Direccion As Byte
  2844.    
  2845.         Direccion = incomingData.ReadByte()
  2846.  
  2847.         Call MoveCharbyHead(UserCharIndex, Direccion)
  2848.         Call MoveScreen(Direccion)
  2849.    
  2850.         Call RefreshAllChars
  2851.  
  2852. End Sub
  2853.  
  2854. ''
  2855. ' Handles the CharacterChange message.
  2856.  
  2857. Private Sub HandleCharacterChange()
  2858.  
  2859.         '***************************************************
  2860.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2861.        'Last Modification: 21/09/2010 - C4b3z0n
  2862.        '25/08/2009: ZaMa - Changed a variable used incorrectly.
  2863.        '21/09/2010: C4b3z0n - Added code for FragShooter. If its waiting for the death of certain UserIndex, and it dies, then the capture of the screen will occur.
  2864.        '***************************************************
  2865.        If incomingData.Length < 18 Then
  2866.                 Err.Raise incomingData.NotEnoughDataErrCode
  2867.                 Exit Sub
  2868.  
  2869.         End If
  2870.    
  2871.         'Remove packet ID
  2872.        Call incomingData.ReadByte
  2873.    
  2874.         Dim CharIndex As Integer
  2875.  
  2876.         Dim tempint   As Integer
  2877.  
  2878.         Dim headIndex As Integer
  2879.    
  2880.         CharIndex = incomingData.ReadInteger()
  2881.    
  2882.         With charlist(CharIndex)
  2883.                 tempint = incomingData.ReadInteger()
  2884.        
  2885.                 If tempint < LBound(BodyData()) Or tempint > UBound(BodyData()) Then
  2886.                         .Body = BodyData(0)
  2887.                         .iBody = 0
  2888.                 Else
  2889.                         .Body = BodyData(tempint)
  2890.                         .iBody = tempint
  2891.  
  2892.                 End If
  2893.        
  2894.                 headIndex = incomingData.ReadInteger()
  2895.        
  2896.                 If headIndex < LBound(HeadData()) Or headIndex > UBound(HeadData()) Then
  2897.                         .Head = HeadData(0)
  2898.                         .iHead = 0
  2899.                 Else
  2900.                         .Head = HeadData(headIndex)
  2901.                         .iHead = headIndex
  2902.  
  2903.                 End If
  2904.        
  2905.                 .muerto = (headIndex = CASPER_HEAD)
  2906.        
  2907.                 .Heading = incomingData.ReadByte()
  2908.        
  2909.                 tempint = incomingData.ReadInteger()
  2910.  
  2911.                 If tempint <> 0 Then .Arma = WeaponAnimData(tempint)
  2912.        
  2913.                 tempint = incomingData.ReadInteger()
  2914.  
  2915.                 If tempint <> 0 Then .Escudo = ShieldAnimData(tempint)
  2916.        
  2917.                 tempint = incomingData.ReadInteger()
  2918.  
  2919.                 If tempint <> 0 Then .Casco = CascoAnimData(tempint)
  2920.        
  2921.                 Call SetCharacterFx(CharIndex, incomingData.ReadInteger(), incomingData.ReadInteger())
  2922.  
  2923.         End With
  2924.    
  2925.         Call RefreshAllChars
  2926.  
  2927. End Sub
  2928.  
  2929. ''
  2930. ' Handles the ObjectCreate message.
  2931.  
  2932. Private Sub HandleObjectCreate()
  2933.  
  2934.         '***************************************************
  2935.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2936.        'Last Modification: 05/17/06
  2937.        '
  2938.        '***************************************************
  2939.        If incomingData.Length < 5 Then
  2940.                 Err.Raise incomingData.NotEnoughDataErrCode
  2941.                 Exit Sub
  2942.  
  2943.         End If
  2944.    
  2945.         'Remove packet ID
  2946.        Call incomingData.ReadByte
  2947.    
  2948.         Dim x As Byte
  2949.  
  2950.         Dim y As Byte
  2951.    
  2952.         x = incomingData.ReadByte()
  2953.         y = incomingData.ReadByte()
  2954.    
  2955.         MapData(x, y).ObjGrh.GrhIndex = incomingData.ReadInteger()
  2956.    
  2957.         Call InitGrh(MapData(x, y).ObjGrh, MapData(x, y).ObjGrh.GrhIndex)
  2958.  
  2959. End Sub
  2960.  
  2961. ''
  2962. ' Handles the ObjectDelete message.
  2963.  
  2964. Private Sub HandleObjectDelete()
  2965.  
  2966.         '***************************************************
  2967.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2968.        'Last Modification: 05/17/06
  2969.        '
  2970.        '***************************************************
  2971.        If incomingData.Length < 3 Then
  2972.                 Err.Raise incomingData.NotEnoughDataErrCode
  2973.                 Exit Sub
  2974.  
  2975.         End If
  2976.    
  2977.         'Remove packet ID
  2978.        Call incomingData.ReadByte
  2979.    
  2980.         Dim x As Byte
  2981.  
  2982.         Dim y As Byte
  2983.    
  2984.         x = incomingData.ReadByte()
  2985.         y = incomingData.ReadByte()
  2986.         MapData(x, y).ObjGrh.GrhIndex = 0
  2987.  
  2988. End Sub
  2989.  
  2990. ''
  2991. ' Handles the BlockPosition message.
  2992.  
  2993. Private Sub HandleBlockPosition()
  2994.  
  2995.         '***************************************************
  2996.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  2997.        'Last Modification: 05/17/06
  2998.        '
  2999.        '***************************************************
  3000.        If incomingData.Length < 4 Then
  3001.                 Err.Raise incomingData.NotEnoughDataErrCode
  3002.                 Exit Sub
  3003.  
  3004.         End If
  3005.    
  3006.         'Remove packet ID
  3007.        Call incomingData.ReadByte
  3008.    
  3009.         Dim x As Byte
  3010.  
  3011.         Dim y As Byte
  3012.    
  3013.         x = incomingData.ReadByte()
  3014.         y = incomingData.ReadByte()
  3015.    
  3016.         If incomingData.ReadBoolean() Then
  3017.                 MapData(x, y).Blocked = 1
  3018.         Else
  3019.                 MapData(x, y).Blocked = 0
  3020.  
  3021.         End If
  3022.  
  3023. End Sub
  3024.  
  3025. ''
  3026. ' Handles the PlayMIDI message.
  3027.  
  3028. Private Sub HandlePlayMIDI()
  3029.  
  3030.         '***************************************************
  3031.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3032.        'Last Modification: 05/17/06
  3033.        '
  3034.        '***************************************************
  3035.        If incomingData.Length < 5 Then
  3036.                 Err.Raise incomingData.NotEnoughDataErrCode
  3037.                 Exit Sub
  3038.  
  3039.         End If
  3040.    
  3041.         Dim currentMidi As Integer
  3042.  
  3043.         Dim Loops       As Integer
  3044.    
  3045.         'Remove packet ID
  3046.        Call incomingData.ReadByte
  3047.    
  3048.         currentMidi = incomingData.ReadInteger()
  3049.         Loops = incomingData.ReadInteger()
  3050.    
  3051.         If currentMidi Then
  3052.                 If currentMidi > MP3_INITIAL_INDEX Then
  3053.                         Call Audio.MusicMP3Play(App.Path & "\MP3\" & currentMidi & ".mp3")
  3054.                 Else
  3055.                         Call Audio.PlayMIDI(CStr(currentMidi) & ".mid", Loops)
  3056.  
  3057.                 End If
  3058.  
  3059.         End If
  3060.    
  3061. End Sub
  3062.  
  3063. ''
  3064. ' Handles the PlayWave message.
  3065.  
  3066. Private Sub HandlePlayWave()
  3067.  
  3068.         '***************************************************
  3069.        'Autor: Juan Martín Sotuyo Dodero (Maraxus)
  3070.        'Last Modification: 08/14/07
  3071.        'Last Modified by: Rapsodius
  3072.        'Added support for 3D Sounds.
  3073.        '***************************************************
  3074.        If incomingData.Length < 3 Then
  3075.                 Err.Raise incomingData.NotEnoughDataErrCode
  3076.                 Exit Sub
  3077.  
  3078.         End If
  3079.    
  3080.         'Remove packet ID
  3081.        Call incomingData.ReadByte
  3082.        
  3083.         Dim wave As Byte
  3084.  
  3085.         Dim srcX As Byte
  3086.  
  3087.         Dim srcY As Byte
  3088.    
  3089.         wave = incomingData.ReadByte()
  3090.         srcX = incomingData.ReadByte()
  3091.         srcY = incomingData.ReadByte()
  3092.        
  3093.         Call Audio.PlayWave(CStr(wave) & ".wav", srcX, srcY)
  3094.  
  3095. End Sub
  3096.  
  3097. ''
  3098. ' Handles the GuildList message.
  3099.  
  3100. Private Sub HandleGuildList()
  3101.  
  3102.         '***************************************************
  3103.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3104.        'Last Modification: 05/17/06
  3105.        '
  3106.        '***************************************************
  3107.        If incomingData.Length < 3 Then
  3108.                 Err.Raise incomingData.NotEnoughDataErrCode
  3109.                 Exit Sub
  3110.  
  3111.         End If
  3112.    
  3113.         On Error GoTo ErrHandler
  3114.  
  3115.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  3116.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  3117.  
  3118.         Call Buffer.CopyBuffer(incomingData)
  3119.    
  3120.         'Remove packet ID
  3121.        Call Buffer.ReadByte
  3122.    
  3123.         With frmGuildAdm
  3124.                 'Clear guild's list
  3125.                .guildslist.Clear
  3126.        
  3127.                 GuildNames = Split(Buffer.ReadASCIIString(), SEPARATOR)
  3128.        
  3129.                 Dim i As Long
  3130.  
  3131.                 For i = 0 To UBound(GuildNames())
  3132.                         Call .guildslist.AddItem(GuildNames(i))
  3133.                 Next i
  3134.        
  3135.                 'If we got here then packet is complete, copy data back to original queue
  3136.                Call incomingData.CopyBuffer(Buffer)
  3137.        
  3138.                 .Show vbModeless, frmMain
  3139.  
  3140.         End With
  3141.    
  3142. ErrHandler:
  3143.  
  3144.         Dim error As Long
  3145.  
  3146.         error = Err.number
  3147.  
  3148.         On Error GoTo 0
  3149.    
  3150.         'Destroy auxiliar buffer
  3151.        Set Buffer = Nothing
  3152.  
  3153.         If error <> 0 Then _
  3154.            Err.Raise error
  3155.  
  3156. End Sub
  3157.  
  3158. ''
  3159. ' Handles the AreaChanged message.
  3160.  
  3161. Private Sub HandleAreaChanged()
  3162.  
  3163.         '***************************************************
  3164.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3165.        'Last Modification: 05/17/06
  3166.        '
  3167.        '***************************************************
  3168.        If incomingData.Length < 3 Then
  3169.                 Err.Raise incomingData.NotEnoughDataErrCode
  3170.                 Exit Sub
  3171.  
  3172.         End If
  3173.    
  3174.         'Remove packet ID
  3175.        Call incomingData.ReadByte
  3176.    
  3177.         Dim x As Byte
  3178.  
  3179.         Dim y As Byte
  3180.    
  3181.         x = incomingData.ReadByte()
  3182.         y = incomingData.ReadByte()
  3183.        
  3184.         Call CambioDeArea(x, y)
  3185.  
  3186. End Sub
  3187.  
  3188. ''
  3189. ' Handles the PauseToggle message.
  3190.  
  3191. Private Sub HandlePauseToggle()
  3192.         '***************************************************
  3193.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3194.        'Last Modification: 05/17/06
  3195.        '
  3196.        '***************************************************
  3197.        'Remove packet ID
  3198.        Call incomingData.ReadByte
  3199.    
  3200.         pausa = Not pausa
  3201.  
  3202. End Sub
  3203.  
  3204. ''
  3205. ' Handles the RainToggle message.
  3206.  
  3207. Private Sub HandleRainToggle()
  3208.         '***************************************************
  3209.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3210.        'Last Modification: 05/17/06
  3211.        '
  3212.        '***************************************************
  3213.        'Remove packet ID
  3214.        Call incomingData.ReadByte
  3215.    
  3216.         If Not InMapBounds(UserPos.x, UserPos.y) Then Exit Sub
  3217.    
  3218.         bTecho = (MapData(UserPos.x, UserPos.y).Trigger = 1 Or _
  3219.            MapData(UserPos.x, UserPos.y).Trigger = 2 Or _
  3220.            MapData(UserPos.x, UserPos.y).Trigger = 4)
  3221.        
  3222.         If UserMap = 1 Then
  3223.        
  3224.         If bRain Then
  3225.                 If bLluvia(UserMap) Then
  3226.                         'Stop playing the rain sound
  3227.                        Call Audio.StopWave(RainBufferIndex)
  3228.                         RainBufferIndex = 0
  3229.  
  3230.                         If bTecho Then
  3231.                                 Call Audio.PlayWave("lluviainend.wav", 0, 0, LoopStyle.Disabled)
  3232.                         Else
  3233.                                 Call Audio.PlayWave("lluviaoutend.wav", 0, 0, LoopStyle.Disabled)
  3234.  
  3235.                         End If
  3236.  
  3237.                         frmMain.IsPlaying = PlayLoop.plNone
  3238.  
  3239.                 End If
  3240.  
  3241.         End If
  3242.    
  3243.         End If
  3244.        
  3245.         bRain = Not bRain
  3246.        
  3247.        
  3248. End Sub
  3249.  
  3250. ''
  3251. ' Handles the CreateFX message.
  3252.  
  3253. Private Sub HandleCreateFX()
  3254.  
  3255.         '***************************************************
  3256.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3257.        'Last Modification: 05/17/06
  3258.        '
  3259.        '***************************************************
  3260.        If incomingData.Length < 7 Then
  3261.                 Err.Raise incomingData.NotEnoughDataErrCode
  3262.                 Exit Sub
  3263.  
  3264.         End If
  3265.    
  3266.         'Remove packet ID
  3267.        Call incomingData.ReadByte
  3268.    
  3269.         Dim CharIndex As Integer
  3270.  
  3271.         Dim fX        As Integer
  3272.  
  3273.         Dim Loops     As Integer
  3274.    
  3275.         CharIndex = incomingData.ReadInteger()
  3276.         fX = incomingData.ReadInteger()
  3277.         Loops = incomingData.ReadInteger()
  3278.    
  3279.         Call SetCharacterFx(CharIndex, fX, Loops)
  3280.  
  3281. End Sub
  3282.  
  3283. ''
  3284. ' Handles the UpdateUserStats message.
  3285.  
  3286. Private Sub HandleUpdateUserStats()
  3287.  
  3288.         '***************************************************
  3289.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3290.        'Last Modification: 05/17/06
  3291.        '
  3292.        '***************************************************
  3293.        If incomingData.Length < 26 Then
  3294.                 Err.Raise incomingData.NotEnoughDataErrCode
  3295.                 Exit Sub
  3296.  
  3297.         End If
  3298.    
  3299.         'Remove packet ID
  3300.        Call incomingData.ReadByte
  3301.    
  3302.         UserMaxHP = incomingData.ReadInteger()
  3303.         UserMinHP = incomingData.ReadInteger()
  3304.         UserMaxMAN = incomingData.ReadInteger()
  3305.         UserMinMAN = incomingData.ReadInteger()
  3306.         UserMaxSTA = incomingData.ReadInteger()
  3307.         UserMinSTA = incomingData.ReadInteger()
  3308.         UserGLD = incomingData.ReadLong()
  3309.         UserLvl = incomingData.ReadByte()
  3310.         UserPasarNivel = incomingData.ReadLong()
  3311.         UserExp = incomingData.ReadLong()
  3312.    
  3313.         frmMain.lblExp.Caption = UserExp & "/" & UserPasarNivel
  3314.    
  3315.         If UserPasarNivel > 0 Then
  3316.                 frmMain.lblPorcLvl.Caption = "[" & Round(CDbl(UserExp) * CDbl(100) / CDbl(UserPasarNivel), 2) & "%]"
  3317.         Else
  3318.                 frmMain.lblPorcLvl.Caption = "[N/A]"
  3319.  
  3320.         End If
  3321.    
  3322.         frmMain.GldLbl.Caption = UserGLD
  3323.         frmMain.lblLvl.Caption = UserLvl
  3324.    
  3325.         'Stats
  3326.        frmMain.lblMana.Caption = UserMinMAN & "/" & UserMaxMAN
  3327.         frmMain.lblVida.Caption = UserMinHP & "/" & UserMaxHP
  3328.         frmMain.lblEnergia.Caption = UserMinSTA & "/" & UserMaxSTA
  3329.    
  3330.         'Dim bWidth As Integer
  3331.    
  3332.         '*************************** kidral
  3333.  
  3334.         If UserPasarNivel > 0 Then
  3335.                 frmMain.ImgExp.Width = (((UserExp / 100) / (UserPasarNivel / 100)) * 200)
  3336.         Else
  3337.                 frmMain.ImgExp.Width = 0
  3338.  
  3339.         End If
  3340.  
  3341.         If UserMinMAN > 0 Then
  3342.                 frmMain.shpMana.Width = (((UserMinMAN / 100) / (UserMaxMAN / 100)) * 100)
  3343.  
  3344.         End If
  3345.  
  3346.         frmMain.shpVida.Width = (((UserMinHP / 100) / (UserMaxHP / 100)) * 100)
  3347.    
  3348.         frmMain.shpEnergia.Width = (((UserMinSTA / 100) / (UserMaxSTA / 100)) * 100)
  3349.         '***************************
  3350.    
  3351.         If UserMinHP = 0 Then
  3352.                 UserEstado = 1
  3353.  
  3354.                 If frmMain.TrainingMacro Then Call frmMain.DesactivarMacroHechizos
  3355.                 If frmMain.macrotrabajo Then Call frmMain.DesactivarMacroTrabajo
  3356.         Else
  3357.                 UserEstado = 0
  3358.  
  3359.         End If
  3360.    
  3361.         If UserGLD >= CLng(UserLvl) * 10000 Then
  3362.                 'Changes color
  3363.                frmMain.GldLbl.ForeColor = &HFFFF& 'Red
  3364.        Else
  3365.                 'Changes color
  3366.                frmMain.GldLbl.ForeColor = &HFFFF& 'Yellow
  3367.  
  3368.         End If
  3369.  
  3370. End Sub
  3371.  
  3372. ''
  3373. ' Handles the WorkRequestTarget message.
  3374.  
  3375. Private Sub HandleWorkRequestTarget()
  3376.  
  3377.         '***************************************************
  3378.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3379.        'Last Modification: 05/17/06
  3380.        '
  3381.        '***************************************************
  3382.        If incomingData.Length < 2 Then
  3383.                 Err.Raise incomingData.NotEnoughDataErrCode
  3384.                 Exit Sub
  3385.  
  3386.         End If
  3387.    
  3388.         'Remove packet ID
  3389.        Call incomingData.ReadByte
  3390.    
  3391.         UsingSkill = incomingData.ReadByte()
  3392.  
  3393.         frmMain.MousePointer = 2
  3394.    
  3395.         Select Case UsingSkill
  3396.  
  3397.                 Case Magia
  3398.                         Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_MAGIA, 100, 100, 120, 0, 0)
  3399.  
  3400.                 Case Pesca
  3401.                         Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_PESCA, 100, 100, 120, 0, 0)
  3402.  
  3403.                 Case Robar
  3404.                         Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_ROBAR, 100, 100, 120, 0, 0)
  3405.  
  3406.                 Case Talar
  3407.                         Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_TALAR, 100, 100, 120, 0, 0)
  3408.  
  3409.                 Case Mineria
  3410.                         Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_MINERIA, 100, 100, 120, 0, 0)
  3411.  
  3412.                 Case FundirMetal
  3413.                         Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_FUNDIRMETAL, 100, 100, 120, 0, 0)
  3414.  
  3415.                 Case Proyectiles
  3416.                         Call AddtoRichTextBox(frmMain.RecTxt, MENSAJE_TRABAJO_PROYECTILES, 100, 100, 120, 0, 0)
  3417.  
  3418.         End Select
  3419.  
  3420. End Sub
  3421.  
  3422. ''
  3423. ' Handles the ChangeInventorySlot message.
  3424.  
  3425. Private Sub HandleChangeInventorySlot()
  3426.  
  3427.         '***************************************************
  3428.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3429.        'Last Modification: 05/17/06
  3430.        '
  3431.        '***************************************************
  3432.        If incomingData.Length < 13 Then ' @@ Miqueas Antes 22, reduccion de consumo muy hard
  3433.                Err.Raise incomingData.NotEnoughDataErrCode
  3434.                 Exit Sub
  3435.  
  3436.         End If
  3437.    
  3438.         On Error GoTo ErrHandler
  3439.  
  3440.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  3441.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  3442.  
  3443.         Call Buffer.CopyBuffer(incomingData)
  3444.    
  3445.         'Remove packet ID
  3446.        Call Buffer.ReadByte
  3447.    
  3448.         Dim Slot     As Byte
  3449.  
  3450.         Dim ObjIndex As Integer
  3451.  
  3452.         Dim Name     As String
  3453.  
  3454.         Dim Amount   As Integer
  3455.  
  3456.         Dim Equipped As Boolean
  3457.  
  3458.         Dim GrhIndex As Integer
  3459.  
  3460.         Dim ObjType  As Byte
  3461.  
  3462.         Dim MaxHit   As Integer
  3463.  
  3464.         Dim MinHit   As Integer
  3465.  
  3466.         Dim MaxDef   As Integer
  3467.  
  3468.         Dim MinDef   As Integer
  3469.  
  3470.         Dim Value    As Single
  3471.        
  3472.         Dim Caos     As Byte
  3473.        
  3474.         Dim Real     As Byte
  3475.    
  3476.         Slot = Buffer.ReadByte()
  3477.         ObjIndex = Buffer.ReadInteger()
  3478.         Name = getTypeObj(ObjIndex, enum_TypeObj.Nombre) 'Buffer.ReadASCIIString()
  3479.        
  3480.         Amount = Buffer.ReadInteger()
  3481.         Equipped = Buffer.ReadBoolean()
  3482.        
  3483.         GrhIndex = Val(getTypeObj(ObjIndex, enum_TypeObj.GrhIndex)) 'Buffer.ReadInteger()
  3484.        ObjType = Val(getTypeObj(ObjIndex, enum_TypeObj.ObjType)) 'Buffer.ReadByte()
  3485.        MaxHit = Val(getTypeObj(ObjIndex, enum_TypeObj.MaxHit)) 'Buffer.ReadInteger()
  3486.        MinHit = Val(getTypeObj(ObjIndex, enum_TypeObj.MinHit)) 'Buffer.ReadInteger()
  3487.        
  3488.         ' @@ Usados para identificar las armaduras de segundo rango, que tiene un bono de defensa
  3489.        Real = Buffer.ReadByte()
  3490.         Caos = Buffer.ReadByte()
  3491.  
  3492.         If Real = 2 Or Caos = 2 Then
  3493.                 MaxDef = Val(getTypeObj(ObjIndex, enum_TypeObj.MaxDef) * MOD_DEF_SEG_JERARQUIA) 'Buffer.ReadInteger()
  3494.                MinDef = Val(getTypeObj(ObjIndex, enum_TypeObj.MinDef) * MOD_DEF_SEG_JERARQUIA) 'Buffer.ReadInteger()
  3495.        
  3496.         Else
  3497.                 MaxDef = Val(getTypeObj(ObjIndex, enum_TypeObj.MaxDef)) 'Buffer.ReadInteger()
  3498.                MinDef = Val(getTypeObj(ObjIndex, enum_TypeObj.MinDef)) 'Buffer.ReadInteger()
  3499.  
  3500.         End If
  3501.  
  3502.         Value = Buffer.ReadSingle()
  3503.    
  3504.         If Equipped Then
  3505.  
  3506.                 Select Case ObjType
  3507.  
  3508.                         Case eObjType.otWeapon
  3509.                                 frmMain.lblWeapon = MinHit & "/" & MaxHit
  3510.                                 UserWeaponEqpSlot = Slot
  3511.  
  3512.                         Case eObjType.otArmadura
  3513.                                 frmMain.lblArmor = MinDef & "/" & MaxDef
  3514.                                 UserArmourEqpSlot = Slot
  3515.  
  3516.                         Case eObjType.otescudo
  3517.                                 frmMain.lblShielder = MinDef & "/" & MaxDef
  3518.                                 UserHelmEqpSlot = Slot
  3519.  
  3520.                         Case eObjType.otcasco
  3521.                                 frmMain.lblHelm = MinDef & "/" & MaxDef
  3522.                                 UserShieldEqpSlot = Slot
  3523.  
  3524.                 End Select
  3525.  
  3526.         Else
  3527.  
  3528.                 Select Case Slot
  3529.  
  3530.                         Case UserWeaponEqpSlot
  3531.                                 frmMain.lblWeapon = "0/0"
  3532.                                 UserWeaponEqpSlot = 0
  3533.  
  3534.                         Case UserArmourEqpSlot
  3535.                                 frmMain.lblArmor = "0/0"
  3536.                                 UserArmourEqpSlot = 0
  3537.  
  3538.                         Case UserHelmEqpSlot
  3539.                                 frmMain.lblShielder = "0/0"
  3540.                                 UserHelmEqpSlot = 0
  3541.  
  3542.                         Case UserShieldEqpSlot
  3543.                                 frmMain.lblHelm = "0/0"
  3544.                                 UserShieldEqpSlot = 0
  3545.  
  3546.                 End Select
  3547.  
  3548.         End If
  3549.    
  3550.         Call Inventario.SetItem(Slot, ObjIndex, Amount, Equipped, GrhIndex, ObjType, MaxHit, MinHit, MaxDef, MinDef, Value, Name)
  3551.  
  3552.         'If we got here then packet is complete, copy data back to original queue
  3553.        Call incomingData.CopyBuffer(Buffer)
  3554.    
  3555. ErrHandler:
  3556.  
  3557.         Dim error As Long
  3558.  
  3559.         error = Err.number
  3560.  
  3561.         On Error GoTo 0
  3562.    
  3563.         'Destroy auxiliar buffer
  3564.        Set Buffer = Nothing
  3565.  
  3566.         If error <> 0 Then _
  3567.            Err.Raise error
  3568.  
  3569. End Sub
  3570.  
  3571. ' Handles the StopWorking message.
  3572. Private Sub HandleStopWorking()
  3573.         '***************************************************
  3574.        'Author: Budi
  3575.        'Last Modification: 12/01/09
  3576.        '
  3577.        '***************************************************
  3578.  
  3579.         Call incomingData.ReadByte
  3580.    
  3581.         With FontTypes(FontTypeNames.FONTTYPE_INFO)
  3582.                 Call ShowConsoleMsg("¡Has terminado de trabajar!", .red, .green, .blue, .Bold, .Italic)
  3583.  
  3584.         End With
  3585.    
  3586.         If frmMain.macrotrabajo.Enabled Then Call frmMain.DesactivarMacroTrabajo
  3587.  
  3588. End Sub
  3589.  
  3590. ' Handles the CancelOfferItem message.
  3591.  
  3592. Private Sub HandleCancelOfferItem()
  3593.  
  3594.         '***************************************************
  3595.        'Author: Torres Patricio (Pato)
  3596.        'Last Modification: 05/03/10
  3597.        '
  3598.        '***************************************************
  3599.        Dim Slot   As Byte
  3600.  
  3601.         Dim Amount As Long
  3602.    
  3603.         Call incomingData.ReadByte
  3604.    
  3605.         Slot = incomingData.ReadByte
  3606.    
  3607.         With InvOfferComUsu(0)
  3608.                 Amount = .Amount(Slot)
  3609.        
  3610.                 ' No tiene sentido que se quiten 0 unidades
  3611.                If Amount <> 0 Then
  3612.                         ' Actualizo el inventario general
  3613.                        Call frmComerciarUsu.UpdateInvCom(.ObjIndex(Slot), Amount)
  3614.            
  3615.                         ' Borro el item
  3616.                        Call .SetItem(Slot, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, vbNullString)
  3617.  
  3618.                 End If
  3619.  
  3620.         End With
  3621.    
  3622.         ' Si era el único ítem de la oferta, no puede confirmarla
  3623.        If Not frmComerciarUsu.HasAnyItem(InvOfferComUsu(0)) And _
  3624.            Not frmComerciarUsu.HasAnyItem(InvOroComUsu(1)) Then Call frmComerciarUsu.HabilitarConfirmar(False)
  3625.    
  3626.         With FontTypes(FontTypeNames.FONTTYPE_INFO)
  3627.                 Call frmComerciarUsu.PrintCommerceMsg("¡No puedes comerciar ese objeto!", FontTypeNames.FONTTYPE_INFO)
  3628.  
  3629.         End With
  3630.  
  3631. End Sub
  3632.  
  3633. ''
  3634. ' Handles the ChangeBankSlot message.
  3635.  
  3636. Private Sub HandleChangeBankSlot()
  3637.  
  3638.         '***************************************************
  3639.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3640.        'Last Modification: 05/17/06
  3641.        '
  3642.        '***************************************************
  3643.        If incomingData.Length < 6 Then ' @@ Miqueas Antes 21, reduccion de consumo muy hard
  3644.                Err.Raise incomingData.NotEnoughDataErrCode
  3645.                 Exit Sub
  3646.  
  3647.         End If
  3648.    
  3649.         On Error GoTo ErrHandler
  3650.  
  3651.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  3652.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  3653.  
  3654.         Call Buffer.CopyBuffer(incomingData)
  3655.    
  3656.         'Remove packet ID
  3657.        Call Buffer.ReadByte
  3658.    
  3659.         Dim Slot     As Byte
  3660.         Dim ObjIndex As Integer
  3661.  
  3662.         Slot = Buffer.ReadByte()
  3663.    
  3664.         With UserBancoInventory(Slot)
  3665.        
  3666.                 ObjIndex = Buffer.ReadInteger()
  3667.                
  3668.                 .ObjIndex = ObjIndex
  3669.                 .Name = getTypeObj(ObjIndex, enum_TypeObj.Nombre) 'Buffer.ReadASCIIString()
  3670.                .Amount = Buffer.ReadInteger()
  3671.                 .GrhIndex = Val(getTypeObj(ObjIndex, enum_TypeObj.GrhIndex)) 'Buffer.ReadInteger()
  3672.                .ObjType = Val(getTypeObj(ObjIndex, enum_TypeObj.ObjType)) 'Buffer.ReadByte()
  3673.                .MaxHit = Val(getTypeObj(ObjIndex, enum_TypeObj.MaxHit)) 'Buffer.ReadInteger()
  3674.                .MinHit = Val(getTypeObj(ObjIndex, enum_TypeObj.MinHit)) 'Buffer.ReadInteger()
  3675.                .MaxDef = Val(getTypeObj(ObjIndex, enum_TypeObj.MaxDef)) 'Buffer.ReadInteger()
  3676.                .MinDef = Val(getTypeObj(ObjIndex, enum_TypeObj.MinDef)) 'Buffer.ReadInteger
  3677.                .Valor = Val(getTypeObj(ObjIndex, enum_TypeObj.Valor)) 'Buffer.ReadLong()
  3678.        
  3679.                 If Comerciando Then
  3680.                         Call InvBanco(0).SetItem(Slot, .ObjIndex, .Amount, _
  3681.                            .Equipped, .GrhIndex, .ObjType, .MaxHit, _
  3682.                            .MinHit, .MaxDef, .MinDef, .Valor, .Name)
  3683.  
  3684.                 End If
  3685.  
  3686.         End With
  3687.    
  3688.         'If we got here then packet is complete, copy data back to original queue
  3689.        Call incomingData.CopyBuffer(Buffer)
  3690.    
  3691. ErrHandler:
  3692.  
  3693.         Dim error As Long
  3694.  
  3695.         error = Err.number
  3696.  
  3697.         On Error GoTo 0
  3698.    
  3699.         'Destroy auxiliar buffer
  3700.        Set Buffer = Nothing
  3701.  
  3702.         If error <> 0 Then _
  3703.            Err.Raise error
  3704.  
  3705. End Sub
  3706.  
  3707. ''
  3708. ' Handles the ChangeSpellSlot message.
  3709.  
  3710. Private Sub HandleChangeSpellSlot()
  3711.  
  3712.         '***************************************************
  3713.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3714.        'Last Modification: 05/17/06
  3715.        '
  3716.        '***************************************************
  3717.        If incomingData.Length < 4 Then ' @@ Miqueas Antes 6, reduccion de consumo leve
  3718.                Err.Raise incomingData.NotEnoughDataErrCode
  3719.                 Exit Sub
  3720.  
  3721.         End If
  3722.    
  3723.         On Error GoTo ErrHandler
  3724.  
  3725.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  3726.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  3727.  
  3728.         Call Buffer.CopyBuffer(incomingData)
  3729.    
  3730.         'Remove packet ID
  3731.        Call Buffer.ReadByte
  3732.    
  3733.         Dim Slot      As Byte
  3734.         Dim SpellName As String
  3735.  
  3736.         Slot = Buffer.ReadByte()
  3737.    
  3738.         UserHechizos(Slot) = Buffer.ReadInteger()
  3739.         SpellName = getNameHechizo(UserHechizos(Slot))
  3740.  
  3741.         If Not Len(SpellName) <> 0 Then SpellName = "-None-" ' @@ Miqueas : Parche - 08/12/15
  3742.                
  3743.         If Slot <= frmMain.hlst.ListCount Then
  3744.                 frmMain.hlst.List(Slot - 1) = SpellName
  3745.         Else
  3746.                 Call frmMain.hlst.AddItem(SpellName)
  3747.  
  3748.         End If
  3749.    
  3750.         'If we got here then packet is complete, copy data back to original queue
  3751.        Call incomingData.CopyBuffer(Buffer)
  3752.    
  3753. ErrHandler:
  3754.  
  3755.         Dim error As Long
  3756.  
  3757.         error = Err.number
  3758.  
  3759.         On Error GoTo 0
  3760.    
  3761.         'Destroy auxiliar buffer
  3762.        Set Buffer = Nothing
  3763.  
  3764.         If error <> 0 Then _
  3765.            Err.Raise error
  3766.  
  3767. End Sub
  3768.  
  3769. ''
  3770. ' Handles the Attributes message.
  3771.  
  3772. Private Sub HandleAtributes()
  3773.  
  3774.         '***************************************************
  3775.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3776.        'Last Modification: 05/17/06
  3777.        '
  3778.        '***************************************************
  3779.        If incomingData.Length < 1 + NUMATRIBUTES Then
  3780.                 Err.Raise incomingData.NotEnoughDataErrCode
  3781.                 Exit Sub
  3782.  
  3783.         End If
  3784.    
  3785.         'Remove packet ID
  3786.        Call incomingData.ReadByte
  3787.    
  3788.         Dim i As Long
  3789.    
  3790.         For i = 1 To NUMATRIBUTES
  3791.                 UserAtributos(i) = incomingData.ReadByte()
  3792.         Next i
  3793.  
  3794.         LlegaronAtrib = True
  3795.      
  3796. End Sub
  3797.  
  3798. ''
  3799. ' Handles the BlacksmithWeapons message.
  3800.  
  3801. Private Sub HandleBlacksmithWeapons()
  3802.  
  3803.         '***************************************************
  3804.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3805.        'Last Modification: 05/17/06
  3806.        '
  3807.        '***************************************************
  3808.        If incomingData.Length < 5 Then ' @@ Miqueas Antes 17, reduccion de consumo muy hard
  3809.                Err.Raise incomingData.NotEnoughDataErrCode
  3810.                 Exit Sub
  3811.  
  3812.         End If
  3813.    
  3814.         On Error GoTo ErrHandler
  3815.  
  3816.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  3817.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  3818.  
  3819.         Call Buffer.CopyBuffer(incomingData)
  3820.    
  3821.         'Remove packet ID
  3822.        Call Buffer.ReadByte
  3823.    
  3824.         Dim Count As Integer
  3825.  
  3826.         Dim i     As Long
  3827.  
  3828.         Dim j     As Long
  3829.  
  3830.         Dim K     As Long
  3831.    
  3832.         Count = Buffer.ReadInteger()
  3833.    
  3834.         ReDim ArmasHerrero(Count) As tItemsConstruibles
  3835.         ReDim HerreroMejorar(0) As tItemsConstruibles
  3836.    
  3837.         For i = 1 To Count
  3838.  
  3839.                 With ArmasHerrero(i)
  3840.                
  3841.                         .ObjIndex = Buffer.ReadInteger()
  3842.                         .Name = getTypeObj(.ObjIndex, enum_TypeObj.Nombre) 'Buffer.ReadASCIIString()    'Get the object's name
  3843.                        .GrhIndex = Val(getTypeObj(.ObjIndex, enum_TypeObj.GrhIndex)) 'Buffer.ReadInteger()
  3844.                        .LinH = Val(getTypeObj(.ObjIndex, enum_TypeObj.LingH)) 'Buffer.ReadInteger()        'The iron needed
  3845.                        .LinP = Val(getTypeObj(.ObjIndex, enum_TypeObj.LingP)) 'Buffer.ReadInteger()        'The silver needed
  3846.                        .LinO = Val(getTypeObj(.ObjIndex, enum_TypeObj.LingO)) 'Buffer.ReadInteger()        'The gold needed
  3847.                        
  3848.                         .Upgrade = Val(getTypeObj(.ObjIndex, enum_TypeObj.Upgrade)) 'Buffer.ReadInteger()
  3849.  
  3850.                 End With
  3851.  
  3852.         Next i
  3853.    
  3854.         For i = 1 To MAX_LIST_ITEMS
  3855.                 Set InvLingosHerreria(i) = New clsGrapchicalInventory
  3856.         Next i
  3857.    
  3858.         With frmHerrero
  3859.                 ' Inicializo los inventarios
  3860.                Call InvLingosHerreria(1).Initialize(DirectDraw, .picLingotes0, 3, , , , , , False)
  3861.                 Call InvLingosHerreria(2).Initialize(DirectDraw, .picLingotes1, 3, , , , , , False)
  3862.                 Call InvLingosHerreria(3).Initialize(DirectDraw, .picLingotes2, 3, , , , , , False)
  3863.                 Call InvLingosHerreria(4).Initialize(DirectDraw, .picLingotes3, 3, , , , , , False)
  3864.        
  3865.                 Call .HideExtraControls(Count)
  3866.                 Call .RenderList(1, True)
  3867.  
  3868.         End With
  3869.    
  3870.         For i = 1 To Count
  3871.  
  3872.                 With ArmasHerrero(i)
  3873.  
  3874.                         If .Upgrade Then
  3875.  
  3876.                                 For K = 1 To Count
  3877.  
  3878.                                         If .Upgrade = ArmasHerrero(K).ObjIndex Then
  3879.                                                 j = j + 1
  3880.                
  3881.                                                 ReDim Preserve HerreroMejorar(j) As tItemsConstruibles
  3882.                        
  3883.                                                 HerreroMejorar(j).Name = .Name
  3884.                                                 HerreroMejorar(j).GrhIndex = .GrhIndex
  3885.                                                 HerreroMejorar(j).ObjIndex = .ObjIndex
  3886.                                                 HerreroMejorar(j).UpgradeName = ArmasHerrero(K).Name
  3887.                                                 HerreroMejorar(j).UpgradeGrhIndex = ArmasHerrero(K).GrhIndex
  3888.                                                 HerreroMejorar(j).LinH = ArmasHerrero(K).LinH - .LinH * 0.85
  3889.                                                 HerreroMejorar(j).LinP = ArmasHerrero(K).LinP - .LinP * 0.85
  3890.                                                 HerreroMejorar(j).LinO = ArmasHerrero(K).LinO - .LinO * 0.85
  3891.                        
  3892.                                                 Exit For
  3893.  
  3894.                                         End If
  3895.  
  3896.                                 Next K
  3897.  
  3898.                         End If
  3899.  
  3900.                 End With
  3901.  
  3902.         Next i
  3903.    
  3904.         'If we got here then packet is complete, copy data back to original queue
  3905.        Call incomingData.CopyBuffer(Buffer)
  3906.    
  3907. ErrHandler:
  3908.  
  3909.         Dim error As Long
  3910.  
  3911.         error = Err.number
  3912.  
  3913.         On Error GoTo 0
  3914.    
  3915.         'Destroy auxiliar buffer
  3916.        Set Buffer = Nothing
  3917.  
  3918.         If error <> 0 Then _
  3919.            Err.Raise error
  3920.  
  3921. End Sub
  3922.  
  3923. ''
  3924. ' Handles the BlacksmithArmors message.
  3925.  
  3926. Private Sub HandleBlacksmithArmors()
  3927.  
  3928.         '***************************************************
  3929.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  3930.        'Last Modification: 05/17/06
  3931.        '
  3932.        '***************************************************
  3933.        If incomingData.Length < 5 Then ' @@ Miqueas Antes 17, reduccion de consumo muy hard
  3934.                Err.Raise incomingData.NotEnoughDataErrCode
  3935.                 Exit Sub
  3936.  
  3937.         End If
  3938.    
  3939.         On Error GoTo ErrHandler
  3940.  
  3941.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  3942.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  3943.  
  3944.         Call Buffer.CopyBuffer(incomingData)
  3945.    
  3946.         'Remove packet ID
  3947.        Call Buffer.ReadByte
  3948.    
  3949.         Dim Count As Integer
  3950.  
  3951.         Dim i     As Long
  3952.  
  3953.         Dim j     As Long
  3954.  
  3955.         Dim K     As Long
  3956.    
  3957.         Count = Buffer.ReadInteger()
  3958.    
  3959.         ReDim ArmadurasHerrero(Count) As tItemsConstruibles
  3960.    
  3961.         For i = 1 To Count
  3962.  
  3963.                 With ArmadurasHerrero(i)
  3964.                         .ObjIndex = Buffer.ReadInteger()
  3965.                         .Name = getTypeObj(.ObjIndex, enum_TypeObj.Nombre) 'Buffer.ReadASCIIString()    'Get the object's name
  3966.                        .GrhIndex = Val(getTypeObj(.ObjIndex, enum_TypeObj.GrhIndex)) 'Buffer.ReadInteger()
  3967.                        
  3968.                         .LinH = Val(getTypeObj(.ObjIndex, enum_TypeObj.LingH)) 'Buffer.ReadInteger()        'The iron needed
  3969.                        .LinP = Val(getTypeObj(.ObjIndex, enum_TypeObj.LingP)) 'Buffer.ReadInteger()        'The silver needed
  3970.                        .LinO = Val(getTypeObj(.ObjIndex, enum_TypeObj.LingO)) 'Buffer.ReadInteger()        'The gold needed
  3971.                        
  3972.                         .Upgrade = Val(getTypeObj(.ObjIndex, enum_TypeObj.Upgrade)) 'Buffer.ReadInteger()
  3973.  
  3974.                 End With
  3975.  
  3976.         Next i
  3977.    
  3978.         j = UBound(HerreroMejorar)
  3979.    
  3980.         For i = 1 To Count
  3981.  
  3982.                 With ArmadurasHerrero(i)
  3983.  
  3984.                         If .Upgrade Then
  3985.  
  3986.                                 For K = 1 To Count
  3987.  
  3988.                                         If .Upgrade = ArmadurasHerrero(K).ObjIndex Then
  3989.                                                 j = j + 1
  3990.                
  3991.                                                 ReDim Preserve HerreroMejorar(j) As tItemsConstruibles
  3992.                        
  3993.                                                 HerreroMejorar(j).Name = .Name
  3994.                                                 HerreroMejorar(j).GrhIndex = .GrhIndex
  3995.                                                 HerreroMejorar(j).ObjIndex = .ObjIndex
  3996.                                                 HerreroMejorar(j).UpgradeName = ArmadurasHerrero(K).Name
  3997.                                                 HerreroMejorar(j).UpgradeGrhIndex = ArmadurasHerrero(K).GrhIndex
  3998.                                                 HerreroMejorar(j).LinH = ArmadurasHerrero(K).LinH - .LinH * 0.85
  3999.                                                 HerreroMejorar(j).LinP = ArmadurasHerrero(K).LinP - .LinP * 0.85
  4000.                                                 HerreroMejorar(j).LinO = ArmadurasHerrero(K).LinO - .LinO * 0.85
  4001.                        
  4002.                                                 Exit For
  4003.  
  4004.                                         End If
  4005.  
  4006.                                 Next K
  4007.  
  4008.                         End If
  4009.  
  4010.                 End With
  4011.  
  4012.         Next i
  4013.    
  4014.         'If we got here then packet is complete, copy data back to original queue
  4015.        Call incomingData.CopyBuffer(Buffer)
  4016.    
  4017. ErrHandler:
  4018.  
  4019.         Dim error As Long
  4020.  
  4021.         error = Err.number
  4022.  
  4023.         On Error GoTo 0
  4024.    
  4025.         'Destroy auxiliar buffer
  4026.        Set Buffer = Nothing
  4027.  
  4028.         If error <> 0 Then _
  4029.            Err.Raise error
  4030.  
  4031. End Sub
  4032.  
  4033. ''
  4034. ' Handles the CarpenterObjects message.
  4035.  
  4036. Private Sub HandleCarpenterObjects()
  4037.  
  4038.         '***************************************************
  4039.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4040.        'Last Modification: 05/17/06
  4041.        '
  4042.        '***************************************************
  4043.        If incomingData.Length < 5 Then ' @@ Miqueas Antes 17, reduccion de consumo muy hard
  4044.                Err.Raise incomingData.NotEnoughDataErrCode
  4045.                 Exit Sub
  4046.  
  4047.         End If
  4048.    
  4049.         On Error GoTo ErrHandler
  4050.  
  4051.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4052.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  4053.  
  4054.         Call Buffer.CopyBuffer(incomingData)
  4055.    
  4056.         'Remove packet ID
  4057.        Call Buffer.ReadByte
  4058.    
  4059.         Dim Count As Integer
  4060.  
  4061.         Dim i     As Long
  4062.  
  4063.         Dim j     As Long
  4064.  
  4065.         Dim K     As Long
  4066.    
  4067.         Count = Buffer.ReadInteger()
  4068.    
  4069.         ReDim ObjCarpintero(Count) As tItemsConstruibles
  4070.         ReDim CarpinteroMejorar(0) As tItemsConstruibles
  4071.    
  4072.         For i = 1 To Count
  4073.  
  4074.                 With ObjCarpintero(i)
  4075.                         .ObjIndex = Buffer.ReadInteger()
  4076.                         .Name = getTypeObj(.ObjIndex, enum_TypeObj.Nombre) 'Buffer.ReadASCIIString()    'Get the object's name
  4077.                        .GrhIndex = Val(getTypeObj(.ObjIndex, enum_TypeObj.GrhIndex)) 'Buffer.ReadInteger()
  4078.  
  4079.                         .Madera = Val(getTypeObj(.ObjIndex, enum_TypeObj.Madera)) 'Buffer.ReadInteger()          'The wood needed
  4080.                        .MaderaElfica = Val(getTypeObj(.ObjIndex, enum_TypeObj.MaderaElfica)) 'Buffer.ReadInteger()    'The elfic wood needed
  4081.                        
  4082.                         .Upgrade = Val(getTypeObj(.ObjIndex, enum_TypeObj.Upgrade)) 'Buffer.ReadInteger()
  4083.  
  4084.                 End With
  4085.  
  4086.         Next i
  4087.    
  4088.         For i = 1 To MAX_LIST_ITEMS
  4089.                 Set InvMaderasCarpinteria(i) = New clsGrapchicalInventory
  4090.         Next i
  4091.    
  4092.         With frmCarp
  4093.                 ' Inicializo los inventarios
  4094.                Call InvMaderasCarpinteria(1).Initialize(DirectDraw, .picMaderas0, 2, , , , , , False)
  4095.                 Call InvMaderasCarpinteria(2).Initialize(DirectDraw, .picMaderas1, 2, , , , , , False)
  4096.                 Call InvMaderasCarpinteria(3).Initialize(DirectDraw, .picMaderas2, 2, , , , , , False)
  4097.                 Call InvMaderasCarpinteria(4).Initialize(DirectDraw, .picMaderas3, 2, , , , , , False)
  4098.        
  4099.                 Call .HideExtraControls(Count)
  4100.                 Call .RenderList(1)
  4101.  
  4102.         End With
  4103.    
  4104.         For i = 1 To Count
  4105.  
  4106.                 With ObjCarpintero(i)
  4107.  
  4108.                         If .Upgrade Then
  4109.  
  4110.                                 For K = 1 To Count
  4111.  
  4112.                                         If .Upgrade = ObjCarpintero(K).ObjIndex Then
  4113.                                                 j = j + 1
  4114.                
  4115.                                                 ReDim Preserve CarpinteroMejorar(j) As tItemsConstruibles
  4116.                        
  4117.                                                 CarpinteroMejorar(j).Name = .Name
  4118.                                                 CarpinteroMejorar(j).GrhIndex = .GrhIndex
  4119.                                                 CarpinteroMejorar(j).ObjIndex = .ObjIndex
  4120.                                                 CarpinteroMejorar(j).UpgradeName = ObjCarpintero(K).Name
  4121.                                                 CarpinteroMejorar(j).UpgradeGrhIndex = ObjCarpintero(K).GrhIndex
  4122.                                                 CarpinteroMejorar(j).Madera = ObjCarpintero(K).Madera - .Madera * 0.85
  4123.                                                 CarpinteroMejorar(j).MaderaElfica = ObjCarpintero(K).MaderaElfica - .MaderaElfica * 0.85
  4124.                        
  4125.                                                 Exit For
  4126.  
  4127.                                         End If
  4128.  
  4129.                                 Next K
  4130.  
  4131.                         End If
  4132.  
  4133.                 End With
  4134.  
  4135.         Next i
  4136.    
  4137.         'If we got here then packet is complete, copy data back to original queue
  4138.        Call incomingData.CopyBuffer(Buffer)
  4139.    
  4140. ErrHandler:
  4141.  
  4142.         Dim error As Long
  4143.  
  4144.         error = Err.number
  4145.  
  4146.         On Error GoTo 0
  4147.    
  4148.         'Destroy auxiliar buffer
  4149.        Set Buffer = Nothing
  4150.  
  4151.         If error <> 0 Then _
  4152.            Err.Raise error
  4153.  
  4154. End Sub
  4155.  
  4156. ''
  4157. ' Handles the RestOK message.
  4158.  
  4159. Private Sub HandleRestOK()
  4160.         '***************************************************
  4161.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4162.        'Last Modification: 05/17/06
  4163.        '
  4164.        '***************************************************
  4165.        'Remove packet ID
  4166.        Call incomingData.ReadByte
  4167.    
  4168.         UserDescansar = Not UserDescansar
  4169.  
  4170. End Sub
  4171.  
  4172. ''
  4173. ' Handles the ErrorMessage message.
  4174.  
  4175. Private Sub HandleErrorMessage()
  4176.  
  4177.         '***************************************************
  4178.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4179.        'Last Modification: 05/17/06
  4180.        '
  4181.        '***************************************************
  4182.        If incomingData.Length < 3 Then
  4183.                 Err.Raise incomingData.NotEnoughDataErrCode
  4184.                 Exit Sub
  4185.  
  4186.         End If
  4187.    
  4188.         On Error GoTo ErrHandler
  4189.  
  4190.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4191.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  4192.  
  4193.         Call Buffer.CopyBuffer(incomingData)
  4194.    
  4195.         'Remove packet ID
  4196.        Call Buffer.ReadByte
  4197.    
  4198.         Call MsgBox(Buffer.ReadASCIIString())
  4199.    
  4200.         If frmConnect.Visible And (Not frmCrearPersonaje.Visible) Then
  4201.              
  4202.                 frmMain.Socket1.Disconnect
  4203.                 frmMain.Socket1.Cleanup
  4204.  
  4205.         End If
  4206.    
  4207.         'If we got here then packet is complete, copy data back to original queue
  4208.        Call incomingData.CopyBuffer(Buffer)
  4209.    
  4210. ErrHandler:
  4211.  
  4212.         Dim error As Long
  4213.  
  4214.         error = Err.number
  4215.  
  4216.         On Error GoTo 0
  4217.    
  4218.         'Destroy auxiliar buffer
  4219.        Set Buffer = Nothing
  4220.  
  4221.         If error <> 0 Then _
  4222.            Err.Raise error
  4223.  
  4224. End Sub
  4225.  
  4226. ''
  4227. ' Handles the Blind message.
  4228.  
  4229. Private Sub HandleBlind()
  4230.         '***************************************************
  4231.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4232.        'Last Modification: 05/17/06
  4233.        '
  4234.        '***************************************************
  4235.        'Remove packet ID
  4236.        Call incomingData.ReadByte
  4237.    
  4238.         UserCiego = True
  4239.  
  4240. End Sub
  4241.  
  4242. ''
  4243. ' Handles the Dumb message.
  4244.  
  4245. Private Sub HandleDumb()
  4246.         '***************************************************
  4247.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4248.        'Last Modification: 05/17/06
  4249.        '
  4250.        '***************************************************
  4251.        'Remove packet ID
  4252.        Call incomingData.ReadByte
  4253.    
  4254.         UserEstupido = True
  4255.  
  4256. End Sub
  4257.  
  4258. ''
  4259. ' Handles the ShowSignal message.
  4260.  
  4261. Private Sub HandleShowSignal()
  4262.  
  4263.         '***************************************************
  4264.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4265.        'Last Modification: 05/17/06
  4266.        '
  4267.        '***************************************************
  4268.        If incomingData.Length < 5 Then
  4269.                 Err.Raise incomingData.NotEnoughDataErrCode
  4270.                 Exit Sub
  4271.  
  4272.         End If
  4273.    
  4274.         On Error GoTo ErrHandler
  4275.  
  4276.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4277.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  4278.  
  4279.         Call Buffer.CopyBuffer(incomingData)
  4280.    
  4281.         'Remove packet ID
  4282.        Call Buffer.ReadByte
  4283.    
  4284.         Dim tmp As String
  4285.  
  4286.         tmp = Buffer.ReadASCIIString()
  4287.    
  4288.         Call InitCartel(tmp, Buffer.ReadInteger())
  4289.    
  4290.         'If we got here then packet is complete, copy data back to original queue
  4291.        Call incomingData.CopyBuffer(Buffer)
  4292.    
  4293. ErrHandler:
  4294.  
  4295.         Dim error As Long
  4296.  
  4297.         error = Err.number
  4298.  
  4299.         On Error GoTo 0
  4300.    
  4301.         'Destroy auxiliar buffer
  4302.        Set Buffer = Nothing
  4303.  
  4304.         If error <> 0 Then _
  4305.            Err.Raise error
  4306.  
  4307. End Sub
  4308.  
  4309. ''
  4310. ' Handles the ChangeNPCInventorySlot message.
  4311.  
  4312. Private Sub HandleChangeNPCInventorySlot()
  4313.  
  4314.         '***************************************************
  4315.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4316.        'Last Modification: 05/17/06
  4317.        '
  4318.        '***************************************************
  4319.        If incomingData.Length < 9 Then ' @@ Miqueas Antes 22, reduccion de consumo muy hard
  4320.                Err.Raise incomingData.NotEnoughDataErrCode
  4321.                 Exit Sub
  4322.  
  4323.         End If
  4324.    
  4325.         On Error GoTo ErrHandler
  4326.  
  4327.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4328.        Dim Buffer As clsByteQueue
  4329.        
  4330.         Set Buffer = New clsByteQueue
  4331.  
  4332.         Call Buffer.CopyBuffer(incomingData)
  4333.    
  4334.         'Remove packet ID
  4335.        Call Buffer.ReadByte
  4336.    
  4337.         Dim Slot   As Byte
  4338.         Dim oIndex As Integer
  4339.  
  4340.         Slot = Buffer.ReadByte()
  4341.    
  4342.         With NPCInventory(Slot)
  4343.        
  4344.                 oIndex = Buffer.ReadInteger()
  4345.                
  4346.                 .ObjIndex = oIndex
  4347.                 .Amount = Buffer.ReadInteger()
  4348.                 .Valor = Buffer.ReadSingle()
  4349.                
  4350.                 .Name = getTypeObj(oIndex, enum_TypeObj.Nombre) 'Buffer.ReadASCIIString()
  4351.                .GrhIndex = Val(getTypeObj(oIndex, enum_TypeObj.GrhIndex)) 'Buffer.ReadInteger()
  4352.                .ObjType = Val(getTypeObj(oIndex, enum_TypeObj.ObjType)) 'Buffer.ReadByte()
  4353.                .MaxHit = Val(getTypeObj(oIndex, enum_TypeObj.MaxHit)) 'Buffer.ReadInteger()
  4354.                .MinHit = Val(getTypeObj(oIndex, enum_TypeObj.MinHit)) 'Buffer.ReadInteger()
  4355.                .MaxDef = Val(getTypeObj(oIndex, enum_TypeObj.MaxDef)) 'Buffer.ReadInteger()
  4356.                .MinDef = Val(getTypeObj(oIndex, enum_TypeObj.MinDef)) 'Buffer.ReadInteger
  4357.  
  4358.         End With
  4359.        
  4360.         'If we got here then packet is complete, copy data back to original queue
  4361.        Call incomingData.CopyBuffer(Buffer)
  4362.    
  4363. ErrHandler:
  4364.  
  4365.         Dim error As Long
  4366.  
  4367.         error = Err.number
  4368.  
  4369.         On Error GoTo 0
  4370.    
  4371.         'Destroy auxiliar buffer
  4372.        Set Buffer = Nothing
  4373.  
  4374.         If error <> 0 Then _
  4375.            Err.Raise error
  4376.  
  4377. End Sub
  4378.  
  4379. ''
  4380. ' Handles the UpdateHungerAndThirst message.
  4381.  
  4382. ''
  4383. ' Handles the UpdateHungerAndThirst message.
  4384.  
  4385. Private Sub HandleUpdateHungerAndThirst()
  4386.         '***************************************************
  4387.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4388.        'Last Modification: 05/17/06
  4389.        '
  4390.        '***************************************************
  4391.  
  4392.         If incomingData.Length < 5 Then
  4393.                 Err.Raise incomingData.NotEnoughDataErrCode
  4394.  
  4395.                 Exit Sub
  4396.  
  4397.         End If
  4398.    
  4399.         'Remove packet ID
  4400.        Call incomingData.ReadByte
  4401.    
  4402.         UserMaxAGU = incomingData.ReadByte()
  4403.         UserMinAGU = incomingData.ReadByte()
  4404.         UserMaxHAM = incomingData.ReadByte()
  4405.         UserMinHAM = incomingData.ReadByte()
  4406.      
  4407.      
  4408.        
  4409.         frmMain.lblHambre = UserMinHAM & "%"
  4410.         frmMain.lblSed = UserMinAGU & "%"
  4411.  
  4412.         Dim bWidth As Byte
  4413.    
  4414.         bWidth = (((UserMinHAM / 100) / (UserMaxHAM / 100)) * 100)
  4415.    
  4416.         frmMain.ShpHambre.Width = bWidth
  4417.         '*********************************
  4418.    
  4419.         bWidth = (((UserMinAGU / 100) / (UserMaxAGU / 100)) * 100)
  4420.    
  4421.         frmMain.ShpAgua.Width = bWidth
  4422.    
  4423. End Sub
  4424.  
  4425. ''
  4426. ' Handles the Fame message.
  4427.  
  4428. Private Sub HandleFame()
  4429.  
  4430.         '***************************************************
  4431.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4432.        'Last Modification: 05/17/06
  4433.        '
  4434.        '***************************************************
  4435.        If incomingData.Length < 29 Then
  4436.                 Err.Raise incomingData.NotEnoughDataErrCode
  4437.                 Exit Sub
  4438.  
  4439.         End If
  4440.    
  4441.         'Remove packet ID
  4442.        Call incomingData.ReadByte
  4443.    
  4444.         With UserReputacion
  4445.                 .AsesinoRep = incomingData.ReadLong()
  4446.                 .BandidoRep = incomingData.ReadLong()
  4447.                 .BurguesRep = incomingData.ReadLong()
  4448.                 .LadronesRep = incomingData.ReadLong()
  4449.                 .NobleRep = incomingData.ReadLong()
  4450.                 .PlebeRep = incomingData.ReadLong()
  4451.                 .Promedio = incomingData.ReadLong()
  4452.  
  4453.         End With
  4454.    
  4455.         LlegoFama = True
  4456.  
  4457. End Sub
  4458.  
  4459. ''
  4460. ' Handles the MiniStats message.
  4461.  
  4462. Private Sub HandleMiniStats()
  4463.  
  4464.         '***************************************************
  4465.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4466.        'Last Modification: 05/17/06
  4467.        '
  4468.        '***************************************************
  4469.        If incomingData.Length < 20 Then
  4470.                 Err.Raise incomingData.NotEnoughDataErrCode
  4471.                 Exit Sub
  4472.  
  4473.         End If
  4474.    
  4475.         'Remove packet ID
  4476.        Call incomingData.ReadByte
  4477.    
  4478.         With UserEstadisticas
  4479.                 .CiudadanosMatados = incomingData.ReadLong()
  4480.                 .CriminalesMatados = incomingData.ReadLong()
  4481.                 .UsuariosMatados = incomingData.ReadLong()
  4482.                 .NpcsMatados = incomingData.ReadInteger()
  4483.                 .Clase = ListaClases(incomingData.ReadByte())
  4484.                 .PenaCarcel = incomingData.ReadLong()
  4485.  
  4486.         End With
  4487.  
  4488. End Sub
  4489.  
  4490. ''
  4491. ' Handles the LevelUp message.
  4492.  
  4493. Private Sub HandleLevelUp()
  4494.  
  4495.         '***************************************************
  4496.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4497.        'Last Modification: 05/17/06
  4498.        '
  4499.        '***************************************************
  4500.        If incomingData.Length < 4 Then
  4501.                 Err.Raise incomingData.NotEnoughDataErrCode
  4502.                 Exit Sub
  4503.  
  4504.         End If
  4505.    
  4506.         'Remove packet ID
  4507.        Call incomingData.ReadByte
  4508.        
  4509.         Dim tmp As Byte
  4510.        
  4511.         tmp = incomingData.ReadByte()
  4512.  
  4513.         If (tmp = 1) Then
  4514.                 SkillPoints = SkillPoints + incomingData.ReadInteger()
  4515.         Else
  4516.                 SkillPoints = 0 + incomingData.ReadInteger()
  4517.  
  4518.         End If
  4519.    
  4520. End Sub
  4521.  
  4522. ''
  4523. ' Handles the AddForumMessage message.
  4524.  
  4525. Private Sub HandleAddForumMessage()
  4526.  
  4527.         '***************************************************
  4528.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4529.        'Last Modification: 05/17/06
  4530.        '
  4531.        '***************************************************
  4532.        If incomingData.Length < 8 Then
  4533.                 Err.Raise incomingData.NotEnoughDataErrCode
  4534.                 Exit Sub
  4535.  
  4536.         End If
  4537.    
  4538.         On Error GoTo ErrHandler
  4539.  
  4540.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4541.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  4542.  
  4543.         Call Buffer.CopyBuffer(incomingData)
  4544.    
  4545.         'Remove packet ID
  4546.        Call Buffer.ReadByte
  4547.    
  4548.         Dim ForumType As eForumMsgType
  4549.  
  4550.         Dim Title     As String
  4551.  
  4552.         Dim Message   As String
  4553.  
  4554.         Dim Author    As String
  4555.    
  4556.         ForumType = Buffer.ReadByte
  4557.    
  4558.         Title = Buffer.ReadASCIIString()
  4559.         Author = Buffer.ReadASCIIString()
  4560.         Message = Buffer.ReadASCIIString()
  4561.    
  4562.         If Not frmForo.ForoLimpio Then
  4563.                 clsForos.ClearForums
  4564.                 frmForo.ForoLimpio = True
  4565.  
  4566.         End If
  4567.  
  4568.         Call clsForos.AddPost(ForumAlignment(ForumType), Title, Author, Message, EsAnuncio(ForumType))
  4569.    
  4570.         'If we got here then packet is complete, copy data back to original queue
  4571.        Call incomingData.CopyBuffer(Buffer)
  4572.    
  4573. ErrHandler:
  4574.  
  4575.         Dim error As Long
  4576.  
  4577.         error = Err.number
  4578.  
  4579.         On Error GoTo 0
  4580.    
  4581.         'Destroy auxiliar buffer
  4582.        Set Buffer = Nothing
  4583.  
  4584.         If error <> 0 Then _
  4585.            Err.Raise error
  4586.  
  4587. End Sub
  4588.  
  4589. ''
  4590. ' Handles the ShowForumForm message.
  4591.  
  4592. Private Sub HandleShowForumForm()
  4593.         '***************************************************
  4594.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4595.        'Last Modification: 05/17/06
  4596.        '
  4597.        '***************************************************
  4598.        'Remove packet ID
  4599.        Call incomingData.ReadByte
  4600.    
  4601.         frmForo.Privilegios = incomingData.ReadByte
  4602.         frmForo.CanPostSticky = incomingData.ReadByte
  4603.    
  4604.         If Not MirandoForo Then
  4605.                 frmForo.Show , frmMain
  4606.  
  4607.         End If
  4608.  
  4609. End Sub
  4610.  
  4611. ''
  4612. ' Handles the SetInvisible message.
  4613.  
  4614. Private Sub HandleSetInvisible()
  4615.  
  4616.         '***************************************************
  4617.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4618.        'Last Modification: 05/17/06
  4619.        '
  4620.        '***************************************************
  4621.        If incomingData.Length < 4 Then
  4622.                 Err.Raise incomingData.NotEnoughDataErrCode
  4623.                 Exit Sub
  4624.  
  4625.         End If
  4626.    
  4627.         'Remove packet ID
  4628.        Call incomingData.ReadByte
  4629.    
  4630.         Dim CharIndex As Integer
  4631.    
  4632.         CharIndex = incomingData.ReadInteger()
  4633.         charlist(CharIndex).invisible = incomingData.ReadBoolean()
  4634.  
  4635. End Sub
  4636.  
  4637. ''
  4638. ' Handles the MeditateToggle message.
  4639.  
  4640. Private Sub HandleMeditateToggle()
  4641.         '***************************************************
  4642.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4643.        'Last Modification: 05/17/06
  4644.        '
  4645.        '***************************************************
  4646.        'Remove packet ID
  4647.        Call incomingData.ReadByte
  4648.    
  4649.         UserMeditar = Not UserMeditar
  4650.  
  4651. End Sub
  4652.  
  4653. ''
  4654. ' Handles the BlindNoMore message.
  4655.  
  4656. Private Sub HandleBlindNoMore()
  4657.         '***************************************************
  4658.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4659.        'Last Modification: 05/17/06
  4660.        '
  4661.        '***************************************************
  4662.        'Remove packet ID
  4663.        Call incomingData.ReadByte
  4664.    
  4665.         UserCiego = False
  4666.  
  4667. End Sub
  4668.  
  4669. ''
  4670. ' Handles the DumbNoMore message.
  4671.  
  4672. Private Sub HandleDumbNoMore()
  4673.         '***************************************************
  4674.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4675.        'Last Modification: 05/17/06
  4676.        '
  4677.        '***************************************************
  4678.        'Remove packet ID
  4679.        Call incomingData.ReadByte
  4680.    
  4681.         UserEstupido = False
  4682.  
  4683. End Sub
  4684.  
  4685. ''
  4686. ' Handles the SendSkills message.
  4687.  
  4688. Private Sub HandleSendSkills()
  4689.  
  4690.         '***************************************************
  4691.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4692.        'Last Modification: 11/19/09
  4693.        '11/19/09: Pato - Now the server send the percentage of progress of the skills.
  4694.        '***************************************************
  4695.        If incomingData.Length < 1 + NUMSKILLS Then
  4696.                 Err.Raise incomingData.NotEnoughDataErrCode
  4697.                 Exit Sub
  4698.  
  4699.         End If
  4700.    
  4701.         'Remove packet ID
  4702.        Call incomingData.ReadByte
  4703.    
  4704.         Dim i As Long
  4705.  
  4706.         For i = 1 To NUMSKILLS
  4707.                 UserSkills(i) = incomingData.ReadByte()
  4708.                 'PorcentajeSkills(i) = incomingData.ReadByte()
  4709.        Next i
  4710.    
  4711.         LlegaronSkills = True
  4712.  
  4713. End Sub
  4714.  
  4715. ''
  4716. ' Handles the TrainerCreatureList message.
  4717.  
  4718. Private Sub HandleTrainerCreatureList()
  4719.  
  4720.         '***************************************************
  4721.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4722.        'Last Modification: 05/17/06
  4723.        '
  4724.        '***************************************************
  4725.        If incomingData.Length < 3 Then
  4726.                 Err.Raise incomingData.NotEnoughDataErrCode
  4727.                 Exit Sub
  4728.  
  4729.         End If
  4730.    
  4731.         On Error GoTo ErrHandler
  4732.  
  4733.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4734.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  4735.  
  4736.         Call Buffer.CopyBuffer(incomingData)
  4737.    
  4738.         'Remove packet ID
  4739.        Call Buffer.ReadByte
  4740.    
  4741.         Dim creatures() As String
  4742.  
  4743.         Dim i           As Long
  4744.    
  4745.         creatures = Split(Buffer.ReadASCIIString(), SEPARATOR)
  4746.    
  4747.         For i = 0 To UBound(creatures())
  4748.                 Call frmEntrenador.lstCriaturas.AddItem(creatures(i))
  4749.         Next i
  4750.  
  4751.         frmEntrenador.Show , frmMain
  4752.    
  4753.         'If we got here then packet is complete, copy data back to original queue
  4754.        Call incomingData.CopyBuffer(Buffer)
  4755.    
  4756. ErrHandler:
  4757.  
  4758.         Dim error As Long
  4759.  
  4760.         error = Err.number
  4761.  
  4762.         On Error GoTo 0
  4763.    
  4764.         'Destroy auxiliar buffer
  4765.        Set Buffer = Nothing
  4766.  
  4767.         If error <> 0 Then _
  4768.            Err.Raise error
  4769.  
  4770. End Sub
  4771.  
  4772. ''
  4773. ' Handles the GuildNews message.
  4774.  
  4775. Private Sub HandleGuildNews()
  4776.  
  4777.         '***************************************************
  4778.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4779.        'Last Modification: 11/19/09
  4780.        '11/19/09: Pato - Is optional show the frmGuildNews form
  4781.        '***************************************************
  4782.        If incomingData.Length < 7 Then
  4783.                 Err.Raise incomingData.NotEnoughDataErrCode
  4784.                 Exit Sub
  4785.  
  4786.         End If
  4787.    
  4788.         On Error GoTo ErrHandler
  4789.  
  4790.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4791.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  4792.  
  4793.         Call Buffer.CopyBuffer(incomingData)
  4794.    
  4795.         'Remove packet ID
  4796.        Call Buffer.ReadByte
  4797.    
  4798.         Dim guildList() As String
  4799.  
  4800.         Dim i           As Long
  4801.  
  4802.         Dim sTemp       As String
  4803.    
  4804.         'Get news' string
  4805.        frmGuildNews.news = Buffer.ReadASCIIString()
  4806.    
  4807.         'Get Enemy guilds list
  4808.        guildList = Split(Buffer.ReadASCIIString(), SEPARATOR)
  4809.    
  4810.         For i = 0 To UBound(guildList)
  4811.                 sTemp = frmGuildNews.txtClanesGuerra.Text
  4812.                 frmGuildNews.txtClanesGuerra.Text = sTemp & guildList(i) & vbCrLf
  4813.         Next i
  4814.    
  4815.         'Get Allied guilds list
  4816.        guildList = Split(Buffer.ReadASCIIString(), SEPARATOR)
  4817.    
  4818.         For i = 0 To UBound(guildList)
  4819.                 sTemp = frmGuildNews.txtClanesAliados.Text
  4820.                 frmGuildNews.txtClanesAliados.Text = sTemp & guildList(i) & vbCrLf
  4821.         Next i
  4822.    
  4823.         If ClientSetup.bGuildNews Or bShowGuildNews Then frmGuildNews.Show vbModeless, frmMain
  4824.    
  4825.         'If we got here then packet is complete, copy data back to original queue
  4826.        Call incomingData.CopyBuffer(Buffer)
  4827.    
  4828. ErrHandler:
  4829.  
  4830.         Dim error As Long
  4831.  
  4832.         error = Err.number
  4833.  
  4834.         On Error GoTo 0
  4835.    
  4836.         'Destroy auxiliar buffer
  4837.        Set Buffer = Nothing
  4838.  
  4839.         If error <> 0 Then _
  4840.            Err.Raise error
  4841.  
  4842. End Sub
  4843.  
  4844. ''
  4845. ' Handles the OfferDetails message.
  4846.  
  4847. Private Sub HandleOfferDetails()
  4848.  
  4849.         '***************************************************
  4850.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4851.        'Last Modification: 05/17/06
  4852.        '
  4853.        '***************************************************
  4854.        If incomingData.Length < 3 Then
  4855.                 Err.Raise incomingData.NotEnoughDataErrCode
  4856.                 Exit Sub
  4857.  
  4858.         End If
  4859.    
  4860.         On Error GoTo ErrHandler
  4861.  
  4862.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4863.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  4864.  
  4865.         Call Buffer.CopyBuffer(incomingData)
  4866.    
  4867.         'Remove packet ID
  4868.        Call Buffer.ReadByte
  4869.    
  4870.         Call frmUserRequest.recievePeticion(Buffer.ReadASCIIString())
  4871.    
  4872.         'If we got here then packet is complete, copy data back to original queue
  4873.        Call incomingData.CopyBuffer(Buffer)
  4874.    
  4875. ErrHandler:
  4876.  
  4877.         Dim error As Long
  4878.  
  4879.         error = Err.number
  4880.  
  4881.         On Error GoTo 0
  4882.    
  4883.         'Destroy auxiliar buffer
  4884.        Set Buffer = Nothing
  4885.  
  4886.         If error <> 0 Then _
  4887.            Err.Raise error
  4888.  
  4889. End Sub
  4890.  
  4891. ''
  4892. ' Handles the AlianceProposalsList message.
  4893.  
  4894. Private Sub HandleAlianceProposalsList()
  4895.  
  4896.         '***************************************************
  4897.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4898.        'Last Modification: 05/17/06
  4899.        '
  4900.        '***************************************************
  4901.        If incomingData.Length < 3 Then
  4902.                 Err.Raise incomingData.NotEnoughDataErrCode
  4903.                 Exit Sub
  4904.  
  4905.         End If
  4906.    
  4907.         On Error GoTo ErrHandler
  4908.  
  4909.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4910.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  4911.  
  4912.         Call Buffer.CopyBuffer(incomingData)
  4913.    
  4914.         'Remove packet ID
  4915.        Call Buffer.ReadByte
  4916.    
  4917.         Dim vsGuildList() As String
  4918.  
  4919.         Dim i             As Long
  4920.    
  4921.         vsGuildList = Split(Buffer.ReadASCIIString(), SEPARATOR)
  4922.    
  4923.         Call frmPeaceProp.lista.Clear
  4924.  
  4925.         For i = 0 To UBound(vsGuildList())
  4926.                 Call frmPeaceProp.lista.AddItem(vsGuildList(i))
  4927.         Next i
  4928.    
  4929.         frmPeaceProp.ProposalType = TIPO_PROPUESTA.ALIANZA
  4930.         Call frmPeaceProp.Show(vbModeless, frmMain)
  4931.    
  4932.         'If we got here then packet is complete, copy data back to original queue
  4933.        Call incomingData.CopyBuffer(Buffer)
  4934.    
  4935. ErrHandler:
  4936.  
  4937.         Dim error As Long
  4938.  
  4939.         error = Err.number
  4940.  
  4941.         On Error GoTo 0
  4942.    
  4943.         'Destroy auxiliar buffer
  4944.        Set Buffer = Nothing
  4945.  
  4946.         If error <> 0 Then _
  4947.            Err.Raise error
  4948.  
  4949. End Sub
  4950.  
  4951. ''
  4952. ' Handles the PeaceProposalsList message.
  4953.  
  4954. Private Sub HandlePeaceProposalsList()
  4955.  
  4956.         '***************************************************
  4957.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4958.        'Last Modification: 05/17/06
  4959.        '
  4960.        '***************************************************
  4961.        If incomingData.Length < 3 Then
  4962.                 Err.Raise incomingData.NotEnoughDataErrCode
  4963.                 Exit Sub
  4964.  
  4965.         End If
  4966.    
  4967.         On Error GoTo ErrHandler
  4968.  
  4969.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  4970.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  4971.  
  4972.         Call Buffer.CopyBuffer(incomingData)
  4973.    
  4974.         'Remove packet ID
  4975.        Call Buffer.ReadByte
  4976.    
  4977.         Dim guildList() As String
  4978.  
  4979.         Dim i           As Long
  4980.    
  4981.         guildList = Split(Buffer.ReadASCIIString(), SEPARATOR)
  4982.    
  4983.         Call frmPeaceProp.lista.Clear
  4984.  
  4985.         For i = 0 To UBound(guildList())
  4986.                 Call frmPeaceProp.lista.AddItem(guildList(i))
  4987.         Next i
  4988.    
  4989.         frmPeaceProp.ProposalType = TIPO_PROPUESTA.PAZ
  4990.         Call frmPeaceProp.Show(vbModeless, frmMain)
  4991.    
  4992.         'If we got here then packet is complete, copy data back to original queue
  4993.        Call incomingData.CopyBuffer(Buffer)
  4994.    
  4995. ErrHandler:
  4996.  
  4997.         Dim error As Long
  4998.  
  4999.         error = Err.number
  5000.  
  5001.         On Error GoTo 0
  5002.    
  5003.         'Destroy auxiliar buffer
  5004.        Set Buffer = Nothing
  5005.  
  5006.         If error <> 0 Then _
  5007.            Err.Raise error
  5008.  
  5009. End Sub
  5010.  
  5011. ''
  5012. ' Handles the CharacterInfo message.
  5013.  
  5014. Private Sub HandleCharacterInfo()
  5015.  
  5016.         '***************************************************
  5017.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5018.        'Last Modification: 05/17/06
  5019.        '
  5020.        '***************************************************
  5021.        If incomingData.Length < 35 Then
  5022.                 Err.Raise incomingData.NotEnoughDataErrCode
  5023.                 Exit Sub
  5024.  
  5025.         End If
  5026.    
  5027.         On Error GoTo ErrHandler
  5028.  
  5029.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5030.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5031.  
  5032.         Call Buffer.CopyBuffer(incomingData)
  5033.    
  5034.         'Remove packet ID
  5035.        Call Buffer.ReadByte
  5036.    
  5037.         With frmCharInfo
  5038.  
  5039.                 If .frmType = CharInfoFrmType.frmMembers Then
  5040.                         .imgRechazar.Visible = False
  5041.                         .imgAceptar.Visible = False
  5042.                         .imgEchar.Visible = True
  5043.                         .imgPeticion.Visible = False
  5044.                 Else
  5045.                         .imgRechazar.Visible = True
  5046.                         .imgAceptar.Visible = True
  5047.                         .imgEchar.Visible = False
  5048.                         .imgPeticion.Visible = True
  5049.  
  5050.                 End If
  5051.        
  5052.                 .Nombre.Caption = Buffer.ReadASCIIString()
  5053.                 .Raza.Caption = ListaRazas(Buffer.ReadByte())
  5054.                 .Clase.Caption = ListaClases(Buffer.ReadByte())
  5055.        
  5056.                 If Buffer.ReadByte() = 1 Then
  5057.                         .Genero.Caption = "Hombre"
  5058.                 Else
  5059.                         .Genero.Caption = "Mujer"
  5060.  
  5061.                 End If
  5062.        
  5063.                 .Nivel.Caption = Buffer.ReadByte()
  5064.                 .Oro.Caption = Buffer.ReadLong()
  5065.                 .Banco.Caption = Buffer.ReadLong()
  5066.        
  5067.                 Dim reputation As Long
  5068.  
  5069.                 reputation = Buffer.ReadLong()
  5070.        
  5071.                 .reputacion.Caption = reputation
  5072.        
  5073.                 .txtPeticiones.Text = Buffer.ReadASCIIString()
  5074.                 .guildactual.Caption = Buffer.ReadASCIIString()
  5075.                 .txtMiembro.Text = Buffer.ReadASCIIString()
  5076.        
  5077.                 Dim armada As Boolean
  5078.  
  5079.                 Dim Caos   As Boolean
  5080.        
  5081.                 armada = Buffer.ReadBoolean()
  5082.                 Caos = Buffer.ReadBoolean()
  5083.        
  5084.                 If armada Then
  5085.                         .ejercito.Caption = "Armada Real"
  5086.                 ElseIf Caos Then
  5087.                         .ejercito.Caption = "Legión Oscura"
  5088.  
  5089.                 End If
  5090.        
  5091.                 .Ciudadanos.Caption = CStr(Buffer.ReadLong())
  5092.                 .criminales.Caption = CStr(Buffer.ReadLong())
  5093.        
  5094.                 If reputation > 0 Then
  5095.                         .Status.Caption = " Ciudadano"
  5096.                         .Status.ForeColor = vbBlue
  5097.                 Else
  5098.                         .Status.Caption = " Criminal"
  5099.                         .Status.ForeColor = vbRed
  5100.  
  5101.                 End If
  5102.        
  5103.                 Call .Show(vbModeless, frmMain)
  5104.  
  5105.         End With
  5106.    
  5107.         'If we got here then packet is complete, copy data back to original queue
  5108.        Call incomingData.CopyBuffer(Buffer)
  5109.    
  5110. ErrHandler:
  5111.  
  5112.         Dim error As Long
  5113.  
  5114.         error = Err.number
  5115.  
  5116.         On Error GoTo 0
  5117.    
  5118.         'Destroy auxiliar buffer
  5119.        Set Buffer = Nothing
  5120.  
  5121.         If error <> 0 Then _
  5122.            Err.Raise error
  5123.  
  5124. End Sub
  5125.  
  5126. ''
  5127. ' Handles the GuildLeaderInfo message.
  5128.  
  5129. Private Sub HandleGuildLeaderInfo()
  5130.  
  5131.         '***************************************************
  5132.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5133.        'Last Modification: 05/17/06
  5134.        '
  5135.        '***************************************************
  5136.        If incomingData.Length < 9 Then
  5137.                 Err.Raise incomingData.NotEnoughDataErrCode
  5138.                 Exit Sub
  5139.  
  5140.         End If
  5141.    
  5142.         On Error GoTo ErrHandler
  5143.  
  5144.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5145.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5146.  
  5147.         Call Buffer.CopyBuffer(incomingData)
  5148.    
  5149.         'Remove packet ID
  5150.        Call Buffer.ReadByte
  5151.    
  5152.         Dim i      As Long
  5153.  
  5154.         Dim List() As String
  5155.    
  5156.         With frmGuildLeader
  5157.                 'Get list of existing guilds
  5158.                GuildNames = Split(Buffer.ReadASCIIString(), SEPARATOR)
  5159.        
  5160.                 'Empty the list
  5161.                Call .guildslist.Clear
  5162.        
  5163.                 For i = 0 To UBound(GuildNames())
  5164.                         Call .guildslist.AddItem(GuildNames(i))
  5165.                 Next i
  5166.        
  5167.                 'Get list of guild's members
  5168.                GuildMembers = Split(Buffer.ReadASCIIString(), SEPARATOR)
  5169.                 .Miembros.Caption = CStr(UBound(GuildMembers()) + 1)
  5170.        
  5171.                 'Empty the list
  5172.                Call .members.Clear
  5173.        
  5174.                 For i = 0 To UBound(GuildMembers())
  5175.                         Call .members.AddItem(GuildMembers(i))
  5176.                 Next i
  5177.        
  5178.                 .txtguildnews = Buffer.ReadASCIIString()
  5179.        
  5180.                 'Get list of join requests
  5181.                List = Split(Buffer.ReadASCIIString(), SEPARATOR)
  5182.        
  5183.                 'Empty the list
  5184.                Call .solicitudes.Clear
  5185.        
  5186.                 For i = 0 To UBound(List())
  5187.                         Call .solicitudes.AddItem(List(i))
  5188.                 Next i
  5189.        
  5190.                 .Show , frmMain
  5191.  
  5192.         End With
  5193.  
  5194.         'If we got here then packet is complete, copy data back to original queue
  5195.        Call incomingData.CopyBuffer(Buffer)
  5196.    
  5197. ErrHandler:
  5198.  
  5199.         Dim error As Long
  5200.  
  5201.         error = Err.number
  5202.  
  5203.         On Error GoTo 0
  5204.    
  5205.         'Destroy auxiliar buffer
  5206.        Set Buffer = Nothing
  5207.  
  5208.         If error <> 0 Then _
  5209.            Err.Raise error
  5210.  
  5211. End Sub
  5212.  
  5213. ''
  5214. ' Handles the GuildDetails message.
  5215.  
  5216. Private Sub HandleGuildDetails()
  5217.  
  5218.         '***************************************************
  5219.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5220.        'Last Modification: 05/17/06
  5221.        '
  5222.        '***************************************************
  5223.        If incomingData.Length < 26 Then
  5224.                 Err.Raise incomingData.NotEnoughDataErrCode
  5225.                 Exit Sub
  5226.  
  5227.         End If
  5228.    
  5229.         On Error GoTo ErrHandler
  5230.  
  5231.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5232.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5233.  
  5234.         Call Buffer.CopyBuffer(incomingData)
  5235.    
  5236.         'Remove packet ID
  5237.        Call Buffer.ReadByte
  5238.    
  5239.         With frmGuildBrief
  5240.                 .imgDeclararGuerra.Visible = .EsLeader
  5241.                 .imgOfrecerAlianza.Visible = .EsLeader
  5242.                 .imgOfrecerPaz.Visible = .EsLeader
  5243.        
  5244.                 .Nombre.Caption = Buffer.ReadASCIIString()
  5245.                 .fundador.Caption = Buffer.ReadASCIIString()
  5246.                 .creacion.Caption = Buffer.ReadASCIIString()
  5247.                 .lider.Caption = Buffer.ReadASCIIString()
  5248.                 .web.Caption = Buffer.ReadASCIIString()
  5249.                 .Miembros.Caption = Buffer.ReadInteger()
  5250.        
  5251.                 If Buffer.ReadBoolean() Then
  5252.                         .eleccion.Caption = "ABIERTA"
  5253.                 Else
  5254.                         .eleccion.Caption = "CERRADA"
  5255.  
  5256.                 End If
  5257.        
  5258.                 .lblAlineacion.Caption = Buffer.ReadASCIIString()
  5259.                 .Enemigos.Caption = Buffer.ReadInteger()
  5260.                 .Aliados.Caption = Buffer.ReadInteger()
  5261.                 .antifaccion.Caption = Buffer.ReadASCIIString()
  5262.        
  5263.                 Dim codexStr() As String
  5264.  
  5265.                 Dim i          As Long
  5266.        
  5267.                 codexStr = Split(Buffer.ReadASCIIString(), SEPARATOR)
  5268.        
  5269.                 For i = 0 To 7
  5270.                         .Codex(i).Caption = codexStr(i)
  5271.                 Next i
  5272.        
  5273.                 .Desc.Text = Buffer.ReadASCIIString()
  5274.  
  5275.         End With
  5276.    
  5277.         'If we got here then packet is complete, copy data back to original queue
  5278.        Call incomingData.CopyBuffer(Buffer)
  5279.    
  5280.         frmGuildBrief.Show vbModeless, frmMain
  5281.    
  5282. ErrHandler:
  5283.  
  5284.         Dim error As Long
  5285.  
  5286.         error = Err.number
  5287.  
  5288.         On Error GoTo 0
  5289.    
  5290.         'Destroy auxiliar buffer
  5291.        Set Buffer = Nothing
  5292.  
  5293.         If error <> 0 Then _
  5294.            Err.Raise error
  5295.  
  5296. End Sub
  5297.  
  5298. ''
  5299. ' Handles the ShowGuildAlign message.
  5300.  
  5301. Private Sub HandleShowGuildAlign()
  5302.         '***************************************************
  5303.        'Author: ZaMa
  5304.        'Last Modification: 14/12/2009
  5305.        '
  5306.        '***************************************************
  5307.        'Remove packet ID
  5308.        Call incomingData.ReadByte
  5309.    
  5310.         frmEligeAlineacion.Show vbModeless, frmMain
  5311.  
  5312. End Sub
  5313.  
  5314. ''
  5315. ' Handles the ShowGuildFundationForm message.
  5316.  
  5317. Private Sub HandleShowGuildFundationForm()
  5318.         '***************************************************
  5319.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5320.        'Last Modification: 05/17/06
  5321.        '
  5322.        '***************************************************
  5323.        'Remove packet ID
  5324.        Call incomingData.ReadByte
  5325.    
  5326.         CreandoClan = True
  5327.         frmGuildFoundation.Show , frmMain
  5328.  
  5329. End Sub
  5330.  
  5331. ''
  5332. ' Handles the ParalizeOK message.
  5333.  
  5334. Private Sub HandleParalizeOK()
  5335.         '***************************************************
  5336.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5337.        'Last Modification: 05/17/06
  5338.        '
  5339.        '***************************************************
  5340.        'Remove packet ID
  5341.        Call incomingData.ReadByte
  5342.    
  5343.         UserParalizado = Not UserParalizado
  5344.  
  5345. End Sub
  5346.  
  5347. ''
  5348. ' Handles the ShowUserRequest message.
  5349.  
  5350. Private Sub HandleShowUserRequest()
  5351.  
  5352.         '***************************************************
  5353.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5354.        'Last Modification: 05/17/06
  5355.        '
  5356.        '***************************************************
  5357.        If incomingData.Length < 3 Then
  5358.                 Err.Raise incomingData.NotEnoughDataErrCode
  5359.                 Exit Sub
  5360.  
  5361.         End If
  5362.    
  5363.         On Error GoTo ErrHandler
  5364.  
  5365.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5366.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5367.  
  5368.         Call Buffer.CopyBuffer(incomingData)
  5369.    
  5370.         'Remove packet ID
  5371.        Call Buffer.ReadByte
  5372.    
  5373.         Call frmUserRequest.recievePeticion(Buffer.ReadASCIIString())
  5374.         Call frmUserRequest.Show(vbModeless, frmMain)
  5375.    
  5376.         'If we got here then packet is complete, copy data back to original queue
  5377.        Call incomingData.CopyBuffer(Buffer)
  5378.    
  5379. ErrHandler:
  5380.  
  5381.         Dim error As Long
  5382.  
  5383.         error = Err.number
  5384.  
  5385.         On Error GoTo 0
  5386.    
  5387.         'Destroy auxiliar buffer
  5388.        Set Buffer = Nothing
  5389.  
  5390.         If error <> 0 Then _
  5391.            Err.Raise error
  5392.  
  5393. End Sub
  5394.  
  5395. ''
  5396. ' Handles the TradeOK message.
  5397.  
  5398. Private Sub HandleTradeOK()
  5399.         '***************************************************
  5400.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5401.        'Last Modification: 05/17/06
  5402.        '
  5403.        '***************************************************
  5404.        'Remove packet ID
  5405.        Call incomingData.ReadByte
  5406.    
  5407.         If frmComerciar.Visible Then
  5408.  
  5409.                 Dim i As Long
  5410.        
  5411.                 'Update user inventory
  5412.                For i = 1 To MAX_INVENTORY_SLOTS
  5413.  
  5414.                         ' Agrego o quito un item en su totalidad
  5415.                        If Inventario.ObjIndex(i) <> InvComUsu.ObjIndex(i) Then
  5416.  
  5417.                                 With Inventario
  5418.                                         Call InvComUsu.SetItem(i, .ObjIndex(i), _
  5419.                                            .Amount(i), .Equipped(i), .GrhIndex(i), _
  5420.                                            .ObjType(i), .MaxHit(i), .MinHit(i), .MaxDef(i), .MinDef(i), _
  5421.                                            .Valor(i), .ItemName(i))
  5422.  
  5423.                                 End With
  5424.  
  5425.                                 ' Vendio o compro cierta cantidad de un item que ya tenia
  5426.                        ElseIf Inventario.Amount(i) <> InvComUsu.Amount(i) Then
  5427.                                 Call InvComUsu.ChangeSlotItemAmount(i, Inventario.Amount(i))
  5428.  
  5429.                         End If
  5430.  
  5431.                 Next i
  5432.        
  5433.                 ' Fill Npc inventory
  5434.                For i = 1 To 20
  5435.  
  5436.                         ' Compraron la totalidad de un item, o vendieron un item que el npc no tenia
  5437.                        If NPCInventory(i).ObjIndex <> InvComNpc.ObjIndex(i) Then
  5438.  
  5439.                                 With NPCInventory(i)
  5440.                                         Call InvComNpc.SetItem(i, .ObjIndex, _
  5441.                                            .Amount, 0, .GrhIndex, _
  5442.                                            .ObjType, .MaxHit, .MinHit, .MaxDef, .MinDef, _
  5443.                                            .Valor, .Name)
  5444.  
  5445.                                 End With
  5446.  
  5447.                                 ' Compraron o vendieron cierta cantidad (no su totalidad)
  5448.                        ElseIf NPCInventory(i).Amount <> InvComNpc.Amount(i) Then
  5449.                                 Call InvComNpc.ChangeSlotItemAmount(i, NPCInventory(i).Amount)
  5450.  
  5451.                         End If
  5452.  
  5453.                 Next i
  5454.    
  5455.         End If
  5456.  
  5457. End Sub
  5458.  
  5459. ''
  5460. ' Handles the BankOK message.
  5461.  
  5462. Private Sub HandleBankOK()
  5463.         '***************************************************
  5464.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5465.        'Last Modification: 05/17/06
  5466.        '
  5467.        '***************************************************
  5468.        'Remove packet ID
  5469.        Call incomingData.ReadByte
  5470.    
  5471.         Dim i As Long
  5472.    
  5473.         If frmBancoObj.Visible Then
  5474.        
  5475.                 For i = 1 To Inventario.MaxObjs
  5476.  
  5477.                         With Inventario
  5478.                                 Call InvBanco(1).SetItem(i, .ObjIndex(i), .Amount(i), _
  5479.                                    .Equipped(i), .GrhIndex(i), .ObjType(i), .MaxHit(i), _
  5480.                                    .MinHit(i), .MaxDef(i), .MinDef(i), .Valor(i), .ItemName(i))
  5481.  
  5482.                         End With
  5483.  
  5484.                 Next i
  5485.        
  5486.                 'Alter order according to if we bought or sold so the labels and grh remain the same
  5487.                If frmBancoObj.LasActionBuy Then
  5488.                         'frmBancoObj.List1(1).ListIndex = frmBancoObj.LastIndex2
  5489.                        'frmBancoObj.List1(0).ListIndex = frmBancoObj.LastIndex1
  5490.                Else
  5491.  
  5492.                         'frmBancoObj.List1(0).ListIndex = frmBancoObj.LastIndex1
  5493.                        'frmBancoObj.List1(1).ListIndex = frmBancoObj.LastIndex2
  5494.                End If
  5495.        
  5496.                 frmBancoObj.NoPuedeMover = False
  5497.  
  5498.         End If
  5499.        
  5500. End Sub
  5501.  
  5502. ''
  5503. ' Handles the ChangeUserTradeSlot message.
  5504.  
  5505. Private Sub HandleChangeUserTradeSlot()
  5506.  
  5507.         '***************************************************
  5508.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5509.        'Last Modification: 05/17/06
  5510.        '
  5511.        '***************************************************
  5512.        If incomingData.Length < 22 Then
  5513.                 Err.Raise incomingData.NotEnoughDataErrCode
  5514.                 Exit Sub
  5515.  
  5516.         End If
  5517.    
  5518.         On Error GoTo ErrHandler
  5519.  
  5520.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5521.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5522.  
  5523.         Call Buffer.CopyBuffer(incomingData)
  5524.    
  5525.         Dim OfferSlot As Byte
  5526.    
  5527.         'Remove packet ID
  5528.        Call Buffer.ReadByte
  5529.    
  5530.         OfferSlot = Buffer.ReadByte
  5531.    
  5532.         With Buffer
  5533.  
  5534.                 If OfferSlot = GOLD_OFFER_SLOT Then
  5535.                         Call InvOroComUsu(2).SetItem(1, .ReadInteger(), .ReadLong(), 0, _
  5536.                            .ReadInteger(), .ReadByte(), .ReadInteger(), _
  5537.                            .ReadInteger(), .ReadInteger(), .ReadInteger(), .ReadLong(), .ReadASCIIString())
  5538.                 Else
  5539.                         Call InvOfferComUsu(1).SetItem(OfferSlot, .ReadInteger(), .ReadLong(), 0, _
  5540.                            .ReadInteger(), .ReadByte(), .ReadInteger(), _
  5541.                            .ReadInteger(), .ReadInteger(), .ReadInteger(), .ReadLong(), .ReadASCIIString())
  5542.  
  5543.                 End If
  5544.  
  5545.         End With
  5546.    
  5547.         Call frmComerciarUsu.PrintCommerceMsg(TradingUserName & " ha modificado su oferta.", FontTypeNames.FONTTYPE_VENENO)
  5548.    
  5549.         'If we got here then packet is complete, copy data back to original queue
  5550.        Call incomingData.CopyBuffer(Buffer)
  5551.    
  5552. ErrHandler:
  5553.  
  5554.         Dim error As Long
  5555.  
  5556.         error = Err.number
  5557.  
  5558.         On Error GoTo 0
  5559.    
  5560.         'Destroy auxiliar buffer
  5561.        Set Buffer = Nothing
  5562.  
  5563.         If error <> 0 Then _
  5564.            Err.Raise error
  5565.  
  5566. End Sub
  5567.  
  5568. ''
  5569. ' Handles the SendNight message.
  5570.  
  5571. Private Sub HandleSendNight()
  5572.  
  5573.         '***************************************************
  5574.        'Author: Fredy Horacio Treboux (liquid)
  5575.        'Last Modification: 01/08/07
  5576.        '
  5577.        '***************************************************
  5578.        If incomingData.Length < 2 Then
  5579.                 Err.Raise incomingData.NotEnoughDataErrCode
  5580.                 Exit Sub
  5581.  
  5582.         End If
  5583.    
  5584.         'Remove packet ID
  5585.        Call incomingData.ReadByte
  5586.    
  5587.         Dim tBool As Boolean 'CHECK, este handle no hace nada con lo que recibe.. porque, ehmm.. no hay noche?.. o si?
  5588.  
  5589.         tBool = incomingData.ReadBoolean()
  5590.  
  5591. End Sub
  5592.  
  5593. ''
  5594. ' Handles the SpawnList message.
  5595.  
  5596. Private Sub HandleSpawnList()
  5597.  
  5598.         '***************************************************
  5599.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5600.        'Last Modification: 05/17/06
  5601.        '
  5602.        '***************************************************
  5603.        If incomingData.Length < 3 Then
  5604.                 Err.Raise incomingData.NotEnoughDataErrCode
  5605.                 Exit Sub
  5606.  
  5607.         End If
  5608.    
  5609.         On Error GoTo ErrHandler
  5610.  
  5611.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5612.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5613.  
  5614.         Call Buffer.CopyBuffer(incomingData)
  5615.    
  5616.         'Remove packet ID
  5617.        Call Buffer.ReadByte
  5618.    
  5619.         Dim creatureList() As String
  5620.  
  5621.         Dim i              As Long
  5622.    
  5623.         creatureList = Split(Buffer.ReadASCIIString(), SEPARATOR)
  5624.    
  5625.         For i = 0 To UBound(creatureList())
  5626.                 Call frmSpawnList.lstCriaturas.AddItem(creatureList(i))
  5627.         Next i
  5628.  
  5629.         frmSpawnList.Show , frmMain
  5630.    
  5631.         'If we got here then packet is complete, copy data back to original queue
  5632.        Call incomingData.CopyBuffer(Buffer)
  5633.    
  5634. ErrHandler:
  5635.  
  5636.         Dim error As Long
  5637.  
  5638.         error = Err.number
  5639.  
  5640.         On Error GoTo 0
  5641.    
  5642.         'Destroy auxiliar buffer
  5643.        Set Buffer = Nothing
  5644.  
  5645.         If error <> 0 Then _
  5646.            Err.Raise error
  5647.  
  5648. End Sub
  5649.  
  5650. ''
  5651. ' Handles the ShowSOSForm message.
  5652.  
  5653. Private Sub HandleShowSOSForm()
  5654.  
  5655.         '***************************************************
  5656.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5657.        'Last Modification: 05/17/06
  5658.        '
  5659.        '***************************************************
  5660.        If incomingData.Length < 3 Then
  5661.                 Err.Raise incomingData.NotEnoughDataErrCode
  5662.                 Exit Sub
  5663.  
  5664.         End If
  5665.    
  5666.         On Error GoTo ErrHandler
  5667.  
  5668.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5669.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5670.  
  5671.         Call Buffer.CopyBuffer(incomingData)
  5672.    
  5673.         'Remove packet ID
  5674.        Call Buffer.ReadByte
  5675.    
  5676.         Dim sosList() As String
  5677.  
  5678.         Dim i         As Long
  5679.    
  5680.         sosList = Split(Buffer.ReadASCIIString(), SEPARATOR)
  5681.    
  5682.         For i = 0 To UBound(sosList())
  5683.                 Call frmMSG.List1.AddItem(sosList(i))
  5684.         Next i
  5685.    
  5686.         frmMSG.Show , frmMain
  5687.    
  5688.         'If we got here then packet is complete, copy data back to original queue
  5689.        Call incomingData.CopyBuffer(Buffer)
  5690.    
  5691. ErrHandler:
  5692.  
  5693.         Dim error As Long
  5694.  
  5695.         error = Err.number
  5696.  
  5697.         On Error GoTo 0
  5698.    
  5699.         'Destroy auxiliar buffer
  5700.        Set Buffer = Nothing
  5701.  
  5702.         If error <> 0 Then _
  5703.            Err.Raise error
  5704.  
  5705. End Sub
  5706.  
  5707. ''
  5708. ' Handles the ShowDenounces message.
  5709.  
  5710. Private Sub HandleShowDenounces()
  5711.  
  5712.         '***************************************************
  5713.        'Author: ZaMa
  5714.        'Last Modification: 14/11/2010
  5715.        '
  5716.        '***************************************************
  5717.        If incomingData.Length < 3 Then
  5718.                 Err.Raise incomingData.NotEnoughDataErrCode
  5719.                 Exit Sub
  5720.  
  5721.         End If
  5722.    
  5723.         On Error GoTo ErrHandler
  5724.  
  5725.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5726.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5727.  
  5728.         Call Buffer.CopyBuffer(incomingData)
  5729.    
  5730.         'Remove packet ID
  5731.        Call Buffer.ReadByte
  5732.    
  5733.         Dim DenounceList() As String
  5734.  
  5735.         Dim DenounceIndex  As Long
  5736.    
  5737.         DenounceList = Split(Buffer.ReadASCIIString(), SEPARATOR)
  5738.    
  5739.         With FontTypes(FontTypeNames.FONTTYPE_GUILDMSG)
  5740.  
  5741.                 For DenounceIndex = 0 To UBound(DenounceList())
  5742.                         Call AddtoRichTextBox(frmMain.RecTxt, DenounceList(DenounceIndex), .red, .green, .blue, .Bold, .Italic)
  5743.                 Next DenounceIndex
  5744.  
  5745.         End With
  5746.    
  5747.         'If we got here then packet is complete, copy data back to original queue
  5748.        Call incomingData.CopyBuffer(Buffer)
  5749.    
  5750. ErrHandler:
  5751.  
  5752.         Dim error As Long
  5753.  
  5754.         error = Err.number
  5755.  
  5756.         On Error GoTo 0
  5757.    
  5758.         'Destroy auxiliar buffer
  5759.        Set Buffer = Nothing
  5760.  
  5761.         If error <> 0 Then _
  5762.            Err.Raise error
  5763.  
  5764. End Sub
  5765.  
  5766. ''
  5767. ' Handles the ShowSOSForm message.
  5768.  
  5769. Private Sub HandleShowPartyForm()
  5770.  
  5771.         '***************************************************
  5772.        'Author: Budi
  5773.        'Last Modification: 11/26/09
  5774.        '
  5775.        '***************************************************
  5776.        If incomingData.Length < 3 Then
  5777.                 Err.Raise incomingData.NotEnoughDataErrCode
  5778.                 Exit Sub
  5779.  
  5780.         End If
  5781.    
  5782.         On Error GoTo ErrHandler
  5783.  
  5784.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5785.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5786.  
  5787.         Call Buffer.CopyBuffer(incomingData)
  5788.    
  5789.         'Remove packet ID
  5790.        Call Buffer.ReadByte
  5791.    
  5792.         Dim members() As String
  5793.  
  5794.         Dim i         As Long
  5795.    
  5796.         EsPartyLeader = CBool(Buffer.ReadByte())
  5797.        
  5798.         members = Split(Buffer.ReadASCIIString(), SEPARATOR)
  5799.  
  5800.         For i = 0 To UBound(members())
  5801.                 Call frmParty.lstMembers.AddItem(members(i))
  5802.         Next i
  5803.    
  5804.         frmParty.lblTotalExp.Caption = Buffer.ReadLong
  5805.         frmParty.Show , frmMain
  5806.    
  5807.         'If we got here then packet is complete, copy data back to original queue
  5808.        Call incomingData.CopyBuffer(Buffer)
  5809.    
  5810. ErrHandler:
  5811.  
  5812.         Dim error As Long
  5813.  
  5814.         error = Err.number
  5815.  
  5816.         On Error GoTo 0
  5817.    
  5818.         'Destroy auxiliar buffer
  5819.        Set Buffer = Nothing
  5820.  
  5821.         If error <> 0 Then _
  5822.            Err.Raise error
  5823.  
  5824. End Sub
  5825.  
  5826. ''
  5827. ' Handles the ShowMOTDEditionForm message.
  5828.  
  5829. Private Sub HandleShowMOTDEditionForm()
  5830.  
  5831.         '***************************************************
  5832.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5833.        'Last Modification: 05/17/06
  5834.        '
  5835.        '*************************************Su**************
  5836.        If incomingData.Length < 3 Then
  5837.                 Err.Raise incomingData.NotEnoughDataErrCode
  5838.                 Exit Sub
  5839.  
  5840.         End If
  5841.    
  5842.         On Error GoTo ErrHandler
  5843.  
  5844.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5845.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5846.  
  5847.         Call Buffer.CopyBuffer(incomingData)
  5848.    
  5849.         'Remove packet ID
  5850.        Call Buffer.ReadByte
  5851.        
  5852.         Dim tmpStr As String
  5853.  
  5854.         tmpStr = Buffer.ReadASCIIString()
  5855.    
  5856.         'frmCambiaMotd.txtMotd.Text =
  5857.        'frmCambiaMotd.Show , frmMain
  5858.    
  5859.         'If we got here then packet is complete, copy data back to original queue
  5860.        Call incomingData.CopyBuffer(Buffer)
  5861.    
  5862. ErrHandler:
  5863.  
  5864.         Dim error As Long
  5865.  
  5866.         error = Err.number
  5867.  
  5868.         On Error GoTo 0
  5869.    
  5870.         'Destroy auxiliar buffer
  5871.        Set Buffer = Nothing
  5872.  
  5873.         If error <> 0 Then _
  5874.            Err.Raise error
  5875.  
  5876. End Sub
  5877.  
  5878. ''
  5879. ' Handles the ShowGMPanelForm message.
  5880.  
  5881. Private Sub HandleShowGMPanelForm()
  5882.         '***************************************************
  5883.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5884.        'Last Modification: 05/17/06
  5885.        '
  5886.        '***************************************************
  5887.        'Remove packet ID
  5888.        Call incomingData.ReadByte
  5889.    
  5890.         frmPanelGm.Show vbModeless, frmMain
  5891.  
  5892. End Sub
  5893.  
  5894. ''
  5895. ' Handles the UserNameList message.
  5896.  
  5897. Private Sub HandleUserNameList()
  5898.  
  5899.         '***************************************************
  5900.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5901.        'Last Modification: 05/17/06
  5902.        '
  5903.        '***************************************************
  5904.        If incomingData.Length < 3 Then
  5905.                 Err.Raise incomingData.NotEnoughDataErrCode
  5906.                 Exit Sub
  5907.  
  5908.         End If
  5909.    
  5910.         On Error GoTo ErrHandler
  5911.  
  5912.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5913.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5914.  
  5915.         Call Buffer.CopyBuffer(incomingData)
  5916.    
  5917.         'Remove packet ID
  5918.        Call Buffer.ReadByte
  5919.    
  5920.         Dim userList() As String
  5921.  
  5922.         Dim i          As Long
  5923.    
  5924.         userList = Split(Buffer.ReadASCIIString(), SEPARATOR)
  5925.    
  5926.         If frmPanelGm.Visible Then
  5927.                 frmPanelGm.cboListaUsus.Clear
  5928.  
  5929.                 For i = 0 To UBound(userList())
  5930.                         Call frmPanelGm.cboListaUsus.AddItem(userList(i))
  5931.                 Next i
  5932.  
  5933.                 If frmPanelGm.cboListaUsus.ListCount > 0 Then frmPanelGm.cboListaUsus.ListIndex = 0
  5934.  
  5935.         End If
  5936.    
  5937.         'If we got here then packet is complete, copy data back to original queue
  5938.        Call incomingData.CopyBuffer(Buffer)
  5939.    
  5940. ErrHandler:
  5941.  
  5942.         Dim error As Long
  5943.  
  5944.         error = Err.number
  5945.  
  5946.         On Error GoTo 0
  5947.    
  5948.         'Destroy auxiliar buffer
  5949.        Set Buffer = Nothing
  5950.  
  5951.         If error <> 0 Then _
  5952.            Err.Raise error
  5953.  
  5954. End Sub
  5955.  
  5956. ''
  5957. ' Handles the Pong message.
  5958.  
  5959. Private Sub HandlePong()
  5960.         '***************************************************
  5961.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  5962.        'Last Modification: 05/17/06
  5963.        '
  5964.        '***************************************************
  5965.        Call incomingData.ReadByte
  5966.    
  5967.         Call AddtoRichTextBox(frmMain.RecTxt, "El ping es " & (GetTickCount - pingTime) & " ms.", 255, 0, 0, True, False, True)
  5968.    
  5969.         pingTime = 0
  5970.  
  5971. End Sub
  5972.  
  5973. ''
  5974. ' Handles the Pong message.
  5975.  
  5976. Private Sub HandleGuildMemberInfo()
  5977.  
  5978.         '***************************************************
  5979.        'Author: ZaMa
  5980.        'Last Modification: 05/17/06
  5981.        '
  5982.        '***************************************************
  5983.        If incomingData.Length < 3 Then
  5984.                 Err.Raise incomingData.NotEnoughDataErrCode
  5985.                 Exit Sub
  5986.  
  5987.         End If
  5988.    
  5989.         On Error GoTo ErrHandler
  5990.  
  5991.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  5992.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  5993.  
  5994.         Call Buffer.CopyBuffer(incomingData)
  5995.    
  5996.         'Remove packet ID
  5997.        Call Buffer.ReadByte
  5998.    
  5999.         With frmGuildMember
  6000.                 'Clear guild's list
  6001.                .lstClanes.Clear
  6002.        
  6003.                 GuildNames = Split(Buffer.ReadASCIIString(), SEPARATOR)
  6004.        
  6005.                 Dim i As Long
  6006.  
  6007.                 For i = 0 To UBound(GuildNames())
  6008.                         Call .lstClanes.AddItem(GuildNames(i))
  6009.                 Next i
  6010.        
  6011.                 'Get list of guild's members
  6012.                GuildMembers = Split(Buffer.ReadASCIIString(), SEPARATOR)
  6013.                 .lblCantMiembros.Caption = CStr(UBound(GuildMembers()) + 1)
  6014.        
  6015.                 'Empty the list
  6016.                Call .lstMiembros.Clear
  6017.        
  6018.                 For i = 0 To UBound(GuildMembers())
  6019.                         Call .lstMiembros.AddItem(GuildMembers(i))
  6020.                 Next i
  6021.        
  6022.                 'If we got here then packet is complete, copy data back to original queue
  6023.                Call incomingData.CopyBuffer(Buffer)
  6024.        
  6025.                 .Show vbModeless, frmMain
  6026.  
  6027.         End With
  6028.    
  6029. ErrHandler:
  6030.  
  6031.         Dim error As Long
  6032.  
  6033.         error = Err.number
  6034.  
  6035.         On Error GoTo 0
  6036.    
  6037.         'Destroy auxiliar buffer
  6038.        Set Buffer = Nothing
  6039.  
  6040.         If error <> 0 Then _
  6041.            Err.Raise error
  6042.  
  6043. End Sub
  6044.  
  6045. ''
  6046. ' Handles the UpdateTag message.
  6047.  
  6048. Private Sub HandleUpdateTagAndStatus()
  6049.  
  6050.         '***************************************************
  6051.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6052.        'Last Modification: 05/17/06
  6053.        '
  6054.        '***************************************************
  6055.        If incomingData.Length < 6 Then
  6056.                 Err.Raise incomingData.NotEnoughDataErrCode
  6057.                 Exit Sub
  6058.  
  6059.         End If
  6060.    
  6061.         On Error GoTo ErrHandler
  6062.  
  6063.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  6064.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  6065.  
  6066.         Call Buffer.CopyBuffer(incomingData)
  6067.    
  6068.         'Remove packet ID
  6069.        Call Buffer.ReadByte
  6070.    
  6071.         Dim CharIndex As Integer
  6072.  
  6073.         Dim NickColor As Byte
  6074.  
  6075.         Dim UserTag   As String
  6076.    
  6077.         CharIndex = Buffer.ReadInteger()
  6078.         NickColor = Buffer.ReadByte()
  6079.         UserTag = Buffer.ReadASCIIString()
  6080.    
  6081.         'Update char status adn tag!
  6082.        With charlist(CharIndex)
  6083.  
  6084.                 If (NickColor And eNickColor.ieCriminal) <> 0 Then
  6085.                         .Criminal = 1
  6086.                 Else
  6087.                         .Criminal = 0
  6088.  
  6089.                 End If
  6090.        
  6091.                 .Atacable = (NickColor And eNickColor.ieAtacable) <> 0
  6092.        
  6093.                 .Nombre = UserTag
  6094.  
  6095.         End With
  6096.    
  6097.         'If we got here then packet is complete, copy data back to original queue
  6098.        Call incomingData.CopyBuffer(Buffer)
  6099.    
  6100. ErrHandler:
  6101.  
  6102.         Dim error As Long
  6103.  
  6104.         error = Err.number
  6105.  
  6106.         On Error GoTo 0
  6107.    
  6108.         'Destroy auxiliar buffer
  6109.        Set Buffer = Nothing
  6110.  
  6111.         If error <> 0 Then _
  6112.            Err.Raise error
  6113.  
  6114. End Sub
  6115.  
  6116. ''
  6117. ' Writes the "LoginExistingChar" message to the outgoing data buffer.
  6118. '
  6119. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6120.  
  6121. Public Sub WriteLoginExistingChar()
  6122.  
  6123.         '***************************************************
  6124.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6125.        'Last Modification: 05/17/06
  6126.        'Writes the "LoginExistingChar" message to the outgoing data buffer
  6127.        '***************************************************
  6128.  
  6129.         With outgoingData
  6130.                 Call .WriteByte(ClientPacketID.LoginExistingChar)
  6131.        
  6132.                 Call .WriteASCIIString(UserName)
  6133.                 Call .WriteASCIIString(UserPassword)
  6134.        
  6135.                 Call .WriteByte(App.Major)
  6136.                 Call .WriteByte(App.Minor)
  6137.                 Call .WriteByte(App.Revision)
  6138.  
  6139.         End With
  6140.  
  6141. End Sub
  6142.  
  6143. ''
  6144. ' Writes the "LoginNewChar" message to the outgoing data buffer.
  6145. '
  6146. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6147.  
  6148. Public Sub WriteLoginNewChar()
  6149.  
  6150.         '***************************************************
  6151.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6152.        'Last Modification: 05/17/06
  6153.        'Writes the "LoginNewChar" message to the outgoing data buffer
  6154.        '***************************************************
  6155.    
  6156.         With outgoingData
  6157.                 Call .WriteByte(ClientPacketID.LoginNewChar)
  6158.        
  6159.                 Call .WriteASCIIString(UserName)
  6160.                 Call .WriteASCIIString(UserPassword)
  6161.        
  6162.                 Call .WriteByte(App.Major)
  6163.                 Call .WriteByte(App.Minor)
  6164.                 Call .WriteByte(App.Revision)
  6165.        
  6166.                 Call .WriteByte(UserRaza)
  6167.                 Call .WriteByte(UserSexo)
  6168.                 Call .WriteByte(UserClase)
  6169.                 Call .WriteInteger(UserHead)
  6170.        
  6171.                 Call .WriteASCIIString(UserEmail)
  6172.        
  6173.                 Call .WriteByte(UserHogar)
  6174.                 Call .WriteASCIIString(UserClave)
  6175.         End With
  6176.  
  6177. End Sub
  6178.  
  6179. ''
  6180. ' Writes the "Talk" message to the outgoing data buffer.
  6181. '
  6182. ' @param    chat The chat text to be sent.
  6183. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6184.  
  6185. Public Sub WriteTalk(ByVal chat As String)
  6186.  
  6187.         '***************************************************
  6188.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6189.        'Last Modification: 05/17/06
  6190.        'Writes the "Talk" message to the outgoing data buffer
  6191.        '***************************************************
  6192.        With outgoingData
  6193.                 Call .WriteByte(ClientPacketID.Talk)
  6194.        
  6195.                 Call .WriteASCIIString(chat)
  6196.  
  6197.         End With
  6198.  
  6199. End Sub
  6200.  
  6201. ''
  6202. ' Writes the "Yell" message to the outgoing data buffer.
  6203. '
  6204. ' @param    chat The chat text to be sent.
  6205. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6206.  
  6207. Public Sub WriteYell(ByVal chat As String)
  6208.  
  6209.         '***************************************************
  6210.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6211.        'Last Modification: 05/17/06
  6212.        'Writes the "Yell" message to the outgoing data buffer
  6213.        '***************************************************
  6214.        With outgoingData
  6215.                 Call .WriteByte(ClientPacketID.Yell)
  6216.        
  6217.                 Call .WriteASCIIString(chat)
  6218.  
  6219.         End With
  6220.  
  6221. End Sub
  6222.  
  6223. ''
  6224. ' Writes the "Whisper" message to the outgoing data buffer.
  6225. '
  6226. ' @param    charIndex The index of the char to whom to whisper.
  6227. ' @param    chat The chat text to be sent to the user.
  6228. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6229.  
  6230. Public Sub WriteWhisper(ByVal CharName As String, ByVal chat As String)
  6231.  
  6232.         '***************************************************
  6233.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6234.        'Last Modification: 03/12/10
  6235.        'Writes the "Whisper" message to the outgoing data buffer
  6236.        '03/12/10: Enanoh - Ahora se envía el nick y no el charindex.
  6237.        '***************************************************
  6238.        With outgoingData
  6239.                 Call .WriteByte(ClientPacketID.Whisper)
  6240.        
  6241.                 Call .WriteASCIIString(CharName)
  6242.        
  6243.                 Call .WriteASCIIString(chat)
  6244.  
  6245.         End With
  6246.  
  6247. End Sub
  6248.  
  6249. ''
  6250. ' Writes the "Walk" message to the outgoing data buffer.
  6251. '
  6252. ' @param    heading The direction in wich the user is moving.
  6253. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6254.  
  6255. Public Sub WriteWalk(ByVal Heading As E_Heading)
  6256.  
  6257.         '***************************************************
  6258.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6259.        'Last Modification: 05/17/06
  6260.        'Writes the "Walk" message to the outgoing data buffer
  6261.        '***************************************************
  6262.        With outgoingData
  6263.                 Call .WriteByte(ClientPacketID.Walk)
  6264.        
  6265.                 Call .WriteByte(Heading)
  6266.  
  6267.         End With
  6268.  
  6269. End Sub
  6270.  
  6271. ''
  6272. ' Writes the "RequestPositionUpdate" message to the outgoing data buffer.
  6273. '
  6274. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6275.  
  6276. Public Sub WriteRequestPositionUpdate()
  6277.         '***************************************************
  6278.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6279.        'Last Modification: 05/17/06
  6280.        'Writes the "RequestPositionUpdate" message to the outgoing data buffer
  6281.        '***************************************************
  6282.        Call outgoingData.WriteByte(ClientPacketID.RequestPositionUpdate)
  6283.  
  6284. End Sub
  6285.  
  6286. ''
  6287. ' Writes the "Attack" message to the outgoing data buffer.
  6288. '
  6289. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6290.  
  6291. Public Sub WriteAttack()
  6292.         '***************************************************
  6293.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6294.        'Last Modification: 05/17/06
  6295.        'Writes the "Attack" message to the outgoing data buffer
  6296.        '***************************************************
  6297.        Call outgoingData.WriteByte(ClientPacketID.Attack)
  6298.  
  6299. End Sub
  6300.  
  6301. ''
  6302. ' Writes the "PickUp" message to the outgoing data buffer.
  6303. '
  6304. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6305.  
  6306. Public Sub WritePickUp()
  6307.         '***************************************************
  6308.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6309.        'Last Modification: 05/17/06
  6310.        'Writes the "PickUp" message to the outgoing data buffer
  6311.        '***************************************************
  6312.        Call outgoingData.WriteByte(ClientPacketID.PickUp)
  6313.  
  6314. End Sub
  6315.  
  6316. ''
  6317. ' Writes the "SafeToggle" message to the outgoing data buffer.
  6318. '
  6319. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6320.  
  6321. Public Sub WriteSafeToggle()
  6322.         '***************************************************
  6323.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6324.        'Last Modification: 05/17/06
  6325.        'Writes the "SafeToggle" message to the outgoing data buffer
  6326.        '***************************************************
  6327.        Call outgoingData.WriteByte(ClientPacketID.SafeToggle)
  6328.  
  6329. End Sub
  6330.  
  6331. ''
  6332. ' Writes the "ResuscitationSafeToggle" message to the outgoing data buffer.
  6333. '
  6334. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6335.  
  6336. Public Sub WriteResuscitationToggle()
  6337.         '**************************************************************
  6338.        'Author: Rapsodius
  6339.        'Creation Date: 10/10/07
  6340.        'Writes the Resuscitation safe toggle packet to the outgoing data buffer.
  6341.        '**************************************************************
  6342.        Call outgoingData.WriteByte(ClientPacketID.ResuscitationSafeToggle)
  6343.  
  6344. End Sub
  6345.  
  6346. ''
  6347. ' Writes the "RequestGuildLeaderInfo" message to the outgoing data buffer.
  6348. '
  6349. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6350.  
  6351. Public Sub WriteRequestGuildLeaderInfo()
  6352.         '***************************************************
  6353.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6354.        'Last Modification: 05/17/06
  6355.        'Writes the "RequestGuildLeaderInfo" message to the outgoing data buffer
  6356.        '***************************************************
  6357.        Call outgoingData.WriteByte(ClientPacketID.RequestGuildLeaderInfo)
  6358.  
  6359. End Sub
  6360.  
  6361. Public Sub WriteRequestPartyForm()
  6362.         '***************************************************
  6363.        'Author: Budi
  6364.        'Last Modification: 11/26/09
  6365.        'Writes the "RequestPartyForm" message to the outgoing data buffer
  6366.        '***************************************************
  6367.        Call outgoingData.WriteByte(ClientPacketID.RequestPartyForm)
  6368.  
  6369. End Sub
  6370.  
  6371. ''
  6372. ' Writes the "ItemUpgrade" message to the outgoing data buffer.
  6373. '
  6374. ' @param    ItemIndex The index to the item to upgrade.
  6375. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6376.  
  6377. Public Sub WriteItemUpgrade(ByVal ItemIndex As Integer)
  6378.         '***************************************************
  6379.        'Author: Torres Patricio (Pato)
  6380.        'Last Modification: 12/09/09
  6381.        'Writes the "ItemUpgrade" message to the outgoing data buffer
  6382.        '***************************************************
  6383.        Call outgoingData.WriteByte(ClientPacketID.ItemUpgrade)
  6384.         Call outgoingData.WriteInteger(ItemIndex)
  6385.  
  6386. End Sub
  6387.  
  6388. ''
  6389. ' Writes the "RequestAtributes" message to the outgoing data buffer.
  6390. '
  6391. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6392.  
  6393. Public Sub WriteRequestAtributes()
  6394.         '***************************************************
  6395.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6396.        'Last Modification: 05/17/06
  6397.        'Writes the "RequestAtributes" message to the outgoing data buffer
  6398.        '***************************************************
  6399.        Call outgoingData.WriteByte(ClientPacketID.RequestAtributes)
  6400.  
  6401. End Sub
  6402.  
  6403. ''
  6404. ' Writes the "RequestFame" message to the outgoing data buffer.
  6405. '
  6406. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6407.  
  6408. Public Sub WriteRequestFame()
  6409.         '***************************************************
  6410.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6411.        'Last Modification: 05/17/06
  6412.        'Writes the "RequestFame" message to the outgoing data buffer
  6413.        '***************************************************
  6414.        Call outgoingData.WriteByte(ClientPacketID.RequestFame)
  6415.  
  6416. End Sub
  6417.  
  6418. ''
  6419. ' Writes the "RequestSkills" message to the outgoing data buffer.
  6420. '
  6421. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6422.  
  6423. Public Sub WriteRequestSkills()
  6424.         '***************************************************
  6425.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6426.        'Last Modification: 05/17/06
  6427.        'Writes the "RequestSkills" message to the outgoing data buffer
  6428.        '***************************************************
  6429.        Call outgoingData.WriteByte(ClientPacketID.RequestSkills)
  6430.  
  6431. End Sub
  6432.  
  6433. ''
  6434. ' Writes the "RequestMiniStats" message to the outgoing data buffer.
  6435. '
  6436. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6437.  
  6438. Public Sub WriteRequestMiniStats()
  6439.         '***************************************************
  6440.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6441.        'Last Modification: 05/17/06
  6442.        'Writes the "RequestMiniStats" message to the outgoing data buffer
  6443.        '***************************************************
  6444.        Call outgoingData.WriteByte(ClientPacketID.RequestMiniStats)
  6445.  
  6446. End Sub
  6447.  
  6448. ''
  6449. ' Writes the "CommerceEnd" message to the outgoing data buffer.
  6450. '
  6451. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6452.  
  6453. Public Sub WriteCommerceEnd()
  6454.         '***************************************************
  6455.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6456.        'Last Modification: 05/17/06
  6457.        'Writes the "CommerceEnd" message to the outgoing data buffer
  6458.        '***************************************************
  6459.        Call outgoingData.WriteByte(ClientPacketID.CommerceEnd)
  6460.  
  6461. End Sub
  6462.  
  6463. ''
  6464. ' Writes the "UserCommerceEnd" message to the outgoing data buffer.
  6465. '
  6466. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6467.  
  6468. Public Sub WriteUserCommerceEnd()
  6469.         '***************************************************
  6470.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6471.        'Last Modification: 05/17/06
  6472.        'Writes the "UserCommerceEnd" message to the outgoing data buffer
  6473.        '***************************************************
  6474.        Call outgoingData.WriteByte(ClientPacketID.UserCommerceEnd)
  6475.  
  6476. End Sub
  6477.  
  6478. ''
  6479. ' Writes the "UserCommerceConfirm" message to the outgoing data buffer.
  6480. '
  6481. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6482.  
  6483. Public Sub WriteUserCommerceConfirm()
  6484.         '***************************************************
  6485.        'Author: ZaMa
  6486.        'Last Modification: 14/12/2009
  6487.        'Writes the "UserCommerceConfirm" message to the outgoing data buffer
  6488.        '***************************************************
  6489.        Call outgoingData.WriteByte(ClientPacketID.UserCommerceConfirm)
  6490.  
  6491. End Sub
  6492.  
  6493. ''
  6494. ' Writes the "BankEnd" message to the outgoing data buffer.
  6495. '
  6496. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6497.  
  6498. Public Sub WriteBankEnd()
  6499.         '***************************************************
  6500.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6501.        'Last Modification: 05/17/06
  6502.        'Writes the "BankEnd" message to the outgoing data buffer
  6503.        '***************************************************
  6504.        Call outgoingData.WriteByte(ClientPacketID.BankEnd)
  6505.  
  6506. End Sub
  6507.  
  6508. ''
  6509. ' Writes the "UserCommerceOk" message to the outgoing data buffer.
  6510. '
  6511. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6512.  
  6513. Public Sub WriteUserCommerceOk()
  6514.         '***************************************************
  6515.        'Author: Fredy Horacio Treboux (liquid)
  6516.        'Last Modification: 01/10/07
  6517.        'Writes the "UserCommerceOk" message to the outgoing data buffer
  6518.        '***************************************************
  6519.        Call outgoingData.WriteByte(ClientPacketID.UserCommerceOk)
  6520.  
  6521. End Sub
  6522.  
  6523. ''
  6524. ' Writes the "UserCommerceReject" message to the outgoing data buffer.
  6525. '
  6526. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6527.  
  6528. Public Sub WriteUserCommerceReject()
  6529.         '***************************************************
  6530.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6531.        'Last Modification: 05/17/06
  6532.        'Writes the "UserCommerceReject" message to the outgoing data buffer
  6533.        '***************************************************
  6534.        Call outgoingData.WriteByte(ClientPacketID.UserCommerceReject)
  6535.  
  6536. End Sub
  6537.  
  6538. ''
  6539. ' Writes the "Drop" message to the outgoing data buffer.
  6540. '
  6541. ' @param    slot Inventory slot where the item to drop is.
  6542. ' @param    amount Number of items to drop.
  6543. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6544.  
  6545. Public Sub WriteDrop(ByVal Slot As Byte, ByVal Amount As Integer)
  6546.  
  6547.         '***************************************************
  6548.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6549.        'Last Modification: 05/17/06
  6550.        'Writes the "Drop" message to the outgoing data buffer
  6551.        '***************************************************
  6552.        With outgoingData
  6553.                 Call .WriteByte(ClientPacketID.Drop)
  6554.        
  6555.                 Call .WriteByte(Slot)
  6556.                 Call .WriteInteger(Amount)
  6557.  
  6558.         End With
  6559.  
  6560. End Sub
  6561.  
  6562. ''
  6563. ' Writes the "CastSpell" message to the outgoing data buffer.
  6564. '
  6565. ' @param    slot Spell List slot where the spell to cast is.
  6566. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6567.  
  6568. Public Sub WriteCastSpell(ByVal Slot As Byte)
  6569.  
  6570.         '***************************************************
  6571.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6572.        'Last Modification: 05/17/06
  6573.        'Writes the "CastSpell" message to the outgoing data buffer
  6574.        '***************************************************
  6575.        With outgoingData
  6576.                 Call .WriteByte(ClientPacketID.CastSpell)
  6577.        
  6578.                 Call .WriteByte(Slot)
  6579.  
  6580.         End With
  6581.  
  6582. End Sub
  6583.  
  6584. ''
  6585. ' Writes the "LeftClick" message to the outgoing data buffer.
  6586. '
  6587. ' @param    x Tile coord in the x-axis in which the user clicked.
  6588. ' @param    y Tile coord in the y-axis in which the user clicked.
  6589. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6590.  
  6591. Public Sub WriteLeftClick(ByVal x As Byte, ByVal y As Byte)
  6592.  
  6593.         '***************************************************
  6594.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6595.        'Last Modification: 05/17/06
  6596.        'Writes the "LeftClick" message to the outgoing data buffer
  6597.        '***************************************************
  6598.        With outgoingData
  6599.                 Call .WriteByte(ClientPacketID.LeftClick)
  6600.        
  6601.                 Call .WriteByte(x)
  6602.                 Call .WriteByte(y)
  6603.  
  6604.         End With
  6605.  
  6606. End Sub
  6607.  
  6608. ''
  6609. ' Writes the "DoubleClick" message to the outgoing data buffer.
  6610. '
  6611. ' @param    x Tile coord in the x-axis in which the user clicked.
  6612. ' @param    y Tile coord in the y-axis in which the user clicked.
  6613. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6614.  
  6615. Public Sub WriteDoubleClick(ByVal x As Byte, ByVal y As Byte)
  6616.  
  6617.         '***************************************************
  6618.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6619.        'Last Modification: 05/17/06
  6620.        'Writes the "DoubleClick" message to the outgoing data buffer
  6621.        '***************************************************
  6622.        With outgoingData
  6623.                 Call .WriteByte(ClientPacketID.DoubleClick)
  6624.        
  6625.                 Call .WriteByte(x)
  6626.                 Call .WriteByte(y)
  6627.  
  6628.         End With
  6629.  
  6630. End Sub
  6631.  
  6632. ''
  6633. ' Writes the "Work" message to the outgoing data buffer.
  6634. '
  6635. ' @param    skill The skill which the user attempts to use.
  6636. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6637.  
  6638. Public Sub WriteWork(ByVal Skill As eSkill)
  6639.  
  6640.         '***************************************************
  6641.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6642.        'Last Modification: 05/17/06
  6643.        'Writes the "Work" message to the outgoing data buffer
  6644.        '***************************************************
  6645.        With outgoingData
  6646.                 Call .WriteByte(ClientPacketID.Work)
  6647.        
  6648.                 Call .WriteByte(Skill)
  6649.  
  6650.         End With
  6651.  
  6652. End Sub
  6653.  
  6654. ''
  6655. ' Writes the "UseSpellMacro" message to the outgoing data buffer.
  6656. '
  6657. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6658.  
  6659. Public Sub WriteUseSpellMacro()
  6660.         '***************************************************
  6661.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6662.        'Last Modification: 05/17/06
  6663.        'Writes the "UseSpellMacro" message to the outgoing data buffer
  6664.        '***************************************************
  6665.        Call outgoingData.WriteByte(ClientPacketID.UseSpellMacro)
  6666.  
  6667. End Sub
  6668.  
  6669. ''
  6670. ' Writes the "UseItem" message to the outgoing data buffer.
  6671. '
  6672. ' @param    slot Invetory slot where the item to use is.
  6673. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6674.  
  6675. Public Sub WriteUseItem(ByVal Slot As Byte, ByVal bClick As Byte)
  6676.  
  6677.         '***************************************************
  6678.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6679.        'Last Modification: 05/17/06
  6680.        'Writes the "UseItem" message to the outgoing data buffer
  6681.        '***************************************************
  6682.        With outgoingData
  6683.                 Call .WriteByte(ClientPacketID.UseItem)
  6684.        
  6685.                 Call .WriteByte(Slot)
  6686.                 Call .WriteByte(bClick)
  6687.  
  6688.         End With
  6689.  
  6690. End Sub
  6691.  
  6692. ''
  6693. ' Writes the "CraftBlacksmith" message to the outgoing data buffer.
  6694. '
  6695. ' @param    item Index of the item to craft in the list sent by the server.
  6696. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6697.  
  6698. Public Sub WriteCraftBlacksmith(ByVal Item As Integer)
  6699.  
  6700.         '***************************************************
  6701.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6702.        'Last Modification: 05/17/06
  6703.        'Writes the "CraftBlacksmith" message to the outgoing data buffer
  6704.        '***************************************************
  6705.        With outgoingData
  6706.                 Call .WriteByte(ClientPacketID.CraftBlacksmith)
  6707.        
  6708.                 Call .WriteInteger(Item)
  6709.  
  6710.         End With
  6711.  
  6712. End Sub
  6713.  
  6714. ''
  6715. ' Writes the "CraftCarpenter" message to the outgoing data buffer.
  6716. '
  6717. ' @param    item Index of the item to craft in the list sent by the server.
  6718. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6719.  
  6720. Public Sub WriteCraftCarpenter(ByVal Item As Integer)
  6721.  
  6722.         '***************************************************
  6723.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6724.        'Last Modification: 05/17/06
  6725.        'Writes the "CraftCarpenter" message to the outgoing data buffer
  6726.        '***************************************************
  6727.        With outgoingData
  6728.                 Call .WriteByte(ClientPacketID.CraftCarpenter)
  6729.        
  6730.                 Call .WriteInteger(Item)
  6731.  
  6732.         End With
  6733.  
  6734. End Sub
  6735.  
  6736. ''
  6737. ' Writes the "ShowGuildNews" message to the outgoing data buffer.
  6738. '
  6739.  
  6740. Public Sub WriteShowGuildNews()
  6741.         '***************************************************
  6742.        'Author: ZaMa
  6743.        'Last Modification: 21/02/2010
  6744.        'Writes the "ShowGuildNews" message to the outgoing data buffer
  6745.        '***************************************************
  6746.  
  6747.         outgoingData.WriteByte (ClientPacketID.ShowGuildNews)
  6748.  
  6749. End Sub
  6750.  
  6751. ''
  6752. ' Writes the "WorkLeftClick" message to the outgoing data buffer.
  6753. '
  6754. ' @param    x Tile coord in the x-axis in which the user clicked.
  6755. ' @param    y Tile coord in the y-axis in which the user clicked.
  6756. ' @param    skill The skill which the user attempts to use.
  6757. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6758.  
  6759. Public Sub WriteWorkLeftClick(ByVal x As Byte, ByVal y As Byte, ByVal Skill As eSkill)
  6760.  
  6761.         '***************************************************
  6762.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6763.        'Last Modification: 05/17/06
  6764.        'Writes the "WorkLeftClick" message to the outgoing data buffer
  6765.        '***************************************************
  6766.        With outgoingData
  6767.                 Call .WriteByte(ClientPacketID.WorkLeftClick)
  6768.        
  6769.                 Call .WriteByte(x)
  6770.                 Call .WriteByte(y)
  6771.        
  6772.                 Call .WriteByte(Skill)
  6773.  
  6774.         End With
  6775.  
  6776. End Sub
  6777.  
  6778. ''
  6779. ' Writes the "CreateNewGuild" message to the outgoing data buffer.
  6780. '
  6781. ' @param    desc    The guild's description
  6782. ' @param    name    The guild's name
  6783. ' @param    site    The guild's website
  6784. ' @param    codex   Array of all rules of the guild.
  6785. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6786.  
  6787. Public Sub WriteCreateNewGuild(ByVal Desc As String, _
  6788.                                ByVal Name As String, _
  6789.                                ByVal Site As String, _
  6790.                                ByRef Codex() As String)
  6791.  
  6792.         '***************************************************
  6793.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6794.        'Last Modification: 05/17/06
  6795.        'Writes the "CreateNewGuild" message to the outgoing data buffer
  6796.        '***************************************************
  6797.        Dim Temp As String
  6798.  
  6799.         Dim i    As Long
  6800.    
  6801.         With outgoingData
  6802.                 Call .WriteByte(ClientPacketID.CreateNewGuild)
  6803.        
  6804.                 Call .WriteASCIIString(Desc)
  6805.  
  6806.                 Call .WriteASCIIString(Name)
  6807.                 Call .WriteASCIIString(Site)
  6808.        
  6809.                 For i = LBound(Codex()) To UBound(Codex())
  6810.                         Temp = Temp & Codex(i) & SEPARATOR
  6811.                 Next i
  6812.        
  6813.                 If Len(Temp) Then _
  6814.                    Temp = Left$(Temp, Len(Temp) - 1)
  6815.        
  6816.                 Call .WriteASCIIString(Temp)
  6817.  
  6818.         End With
  6819.  
  6820. End Sub
  6821.  
  6822. ''
  6823. ' Writes the "SpellInfo" message to the outgoing data buffer.
  6824. '
  6825. ' @param    slot Spell List slot where the spell which's info is requested is.
  6826. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6827.  
  6828. Public Sub WriteSpellInfo(ByVal Slot As Byte)
  6829.  
  6830.         '***************************************************
  6831.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6832.        'Last Modification: 05/17/06
  6833.        'Writes the "SpellInfo" message to the outgoing data buffer
  6834.        '***************************************************
  6835.        With outgoingData
  6836.                 Call .WriteByte(ClientPacketID.SpellInfo)
  6837.        
  6838.                 Call .WriteByte(Slot)
  6839.  
  6840.         End With
  6841.  
  6842. End Sub
  6843.  
  6844. ''
  6845. ' Writes the "EquipItem" message to the outgoing data buffer.
  6846. '
  6847. ' @param    slot Invetory slot where the item to equip is.
  6848. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6849.  
  6850. Public Sub WriteEquipItem(ByVal Slot As Byte)
  6851.  
  6852.         '***************************************************
  6853.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6854.        'Last Modification: 05/17/06
  6855.        'Writes the "EquipItem" message to the outgoing data buffer
  6856.        '***************************************************
  6857.        With outgoingData
  6858.                 Call .WriteByte(ClientPacketID.EquipItem)
  6859.        
  6860.                 Call .WriteByte(Slot)
  6861.  
  6862.         End With
  6863.  
  6864. End Sub
  6865.  
  6866. ''
  6867. ' Writes the "ChangeHeading" message to the outgoing data buffer.
  6868. '
  6869. ' @param    heading The direction in wich the user is moving.
  6870. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6871.  
  6872. Public Sub WriteChangeHeading(ByVal Heading As E_Heading)
  6873.  
  6874.         '***************************************************
  6875.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6876.        'Last Modification: 05/17/06
  6877.        'Writes the "ChangeHeading" message to the outgoing data buffer
  6878.        '***************************************************
  6879.        With outgoingData
  6880.                 Call .WriteByte(ClientPacketID.ChangeHeading)
  6881.        
  6882.                 Call .WriteByte(Heading)
  6883.  
  6884.         End With
  6885.  
  6886. End Sub
  6887.  
  6888. ''
  6889. ' Writes the "ModifySkills" message to the outgoing data buffer.
  6890. '
  6891. ' @param    skillEdt a-based array containing for each skill the number of points to add to it.
  6892. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6893.  
  6894. Public Sub WriteModifySkills(ByRef skillEdt() As Byte)
  6895.  
  6896.         '***************************************************
  6897.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6898.        'Last Modification: 05/17/06
  6899.        'Writes the "ModifySkills" message to the outgoing data buffer
  6900.        '***************************************************
  6901.        Dim i As Long
  6902.    
  6903.         With outgoingData
  6904.                 Call .WriteByte(ClientPacketID.ModifySkills)
  6905.        
  6906.                 For i = 1 To NUMSKILLS
  6907.                         Call .WriteByte(skillEdt(i))
  6908.                 Next i
  6909.  
  6910.         End With
  6911.  
  6912. End Sub
  6913.  
  6914. ''
  6915. ' Writes the "Train" message to the outgoing data buffer.
  6916. '
  6917. ' @param    creature Position within the list provided by the server of the creature to train against.
  6918. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6919.  
  6920. Public Sub WriteTrain(ByVal creature As Byte)
  6921.  
  6922.         '***************************************************
  6923.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6924.        'Last Modification: 05/17/06
  6925.        'Writes the "Train" message to the outgoing data buffer
  6926.        '***************************************************
  6927.        With outgoingData
  6928.                 Call .WriteByte(ClientPacketID.Train)
  6929.        
  6930.                 Call .WriteByte(creature)
  6931.  
  6932.         End With
  6933.  
  6934. End Sub
  6935.  
  6936. ''
  6937. ' Writes the "CommerceBuy" message to the outgoing data buffer.
  6938. '
  6939. ' @param    slot Position within the NPC's inventory in which the desired item is.
  6940. ' @param    amount Number of items to buy.
  6941. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6942.  
  6943. Public Sub WriteCommerceBuy(ByVal Slot As Byte, ByVal Amount As Integer)
  6944.  
  6945.         '***************************************************
  6946.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6947.        'Last Modification: 05/17/06
  6948.        'Writes the "CommerceBuy" message to the outgoing data buffer
  6949.        '***************************************************
  6950.        With outgoingData
  6951.                 Call .WriteByte(ClientPacketID.CommerceBuy)
  6952.        
  6953.                 Call .WriteByte(Slot)
  6954.                 Call .WriteInteger(Amount)
  6955.  
  6956.         End With
  6957.  
  6958. End Sub
  6959.  
  6960. ''
  6961. ' Writes the "BankExtractItem" message to the outgoing data buffer.
  6962. '
  6963. ' @param    slot Position within the bank in which the desired item is.
  6964. ' @param    amount Number of items to extract.
  6965. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6966.  
  6967. Public Sub WriteBankExtractItem(ByVal Slot As Byte, ByVal Amount As Integer)
  6968.  
  6969.         '***************************************************
  6970.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6971.        'Last Modification: 05/17/06
  6972.        'Writes the "BankExtractItem" message to the outgoing data buffer
  6973.        '***************************************************
  6974.        With outgoingData
  6975.                 Call .WriteByte(ClientPacketID.BankExtractItem)
  6976.        
  6977.                 Call .WriteByte(Slot)
  6978.                 Call .WriteInteger(Amount)
  6979.  
  6980.         End With
  6981.  
  6982. End Sub
  6983.  
  6984. ''
  6985. ' Writes the "CommerceSell" message to the outgoing data buffer.
  6986. '
  6987. ' @param    slot Position within user inventory in which the desired item is.
  6988. ' @param    amount Number of items to sell.
  6989. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  6990.  
  6991. Public Sub WriteCommerceSell(ByVal Slot As Byte, ByVal Amount As Integer)
  6992.  
  6993.         '***************************************************
  6994.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  6995.        'Last Modification: 05/17/06
  6996.        'Writes the "CommerceSell" message to the outgoing data buffer
  6997.        '***************************************************
  6998.        With outgoingData
  6999.                 Call .WriteByte(ClientPacketID.CommerceSell)
  7000.        
  7001.                 Call .WriteByte(Slot)
  7002.                 Call .WriteInteger(Amount)
  7003.  
  7004.         End With
  7005.  
  7006. End Sub
  7007.  
  7008. ''
  7009. ' Writes the "BankDeposit" message to the outgoing data buffer.
  7010. '
  7011. ' @param    slot Position within the user inventory in which the desired item is.
  7012. ' @param    amount Number of items to deposit.
  7013. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7014.  
  7015. Public Sub WriteBankDeposit(ByVal Slot As Byte, ByVal Amount As Integer)
  7016.  
  7017.         '***************************************************
  7018.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7019.        'Last Modification: 05/17/06
  7020.        'Writes the "BankDeposit" message to the outgoing data buffer
  7021.        '***************************************************
  7022.        With outgoingData
  7023.                 Call .WriteByte(ClientPacketID.BankDeposit)
  7024.        
  7025.                 Call .WriteByte(Slot)
  7026.                 Call .WriteInteger(Amount)
  7027.  
  7028.         End With
  7029.  
  7030. End Sub
  7031.  
  7032. ''
  7033. ' Writes the "ForumPost" message to the outgoing data buffer.
  7034. '
  7035. ' @param    title The message's title.
  7036. ' @param    message The body of the message.
  7037. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7038.  
  7039. Public Sub WriteForumPost(ByVal Title As String, _
  7040.                           ByVal Message As String, _
  7041.                           ByVal ForumMsgType As Byte)
  7042.  
  7043.         '***************************************************
  7044.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7045.        'Last Modification: 05/17/06
  7046.        'Writes the "ForumPost" message to the outgoing data buffer
  7047.        '***************************************************
  7048.        With outgoingData
  7049.                 Call .WriteByte(ClientPacketID.ForumPost)
  7050.        
  7051.                 Call .WriteByte(ForumMsgType)
  7052.                 Call .WriteASCIIString(Title)
  7053.                 Call .WriteASCIIString(Message)
  7054.  
  7055.         End With
  7056.  
  7057. End Sub
  7058.  
  7059. ''
  7060. ' Writes the "MoveSpell" message to the outgoing data buffer.
  7061. '
  7062. ' @param    upwards True if the spell will be moved up in the list, False if it will be moved downwards.
  7063. ' @param    slot Spell List slot where the spell which's info is requested is.
  7064. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7065.  
  7066. Public Sub WriteMoveSpell(ByVal upwards As Boolean, ByVal Slot As Byte)
  7067.  
  7068.         '***************************************************
  7069.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7070.        'Last Modification: 05/17/06
  7071.        'Writes the "MoveSpell" message to the outgoing data buffer
  7072.        '***************************************************
  7073.        With outgoingData
  7074.                 Call .WriteByte(ClientPacketID.MoveSpell)
  7075.        
  7076.                 Call .WriteBoolean(upwards)
  7077.                 Call .WriteByte(Slot)
  7078.  
  7079.         End With
  7080.  
  7081. End Sub
  7082.  
  7083. ''
  7084. ' Writes the "MoveBank" message to the outgoing data buffer.
  7085. '
  7086. ' @param    upwards True if the item will be moved up in the list, False if it will be moved downwards.
  7087. ' @param    slot Bank List slot where the item which's info is requested is.
  7088. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7089.  
  7090. Public Sub WriteMoveBank(ByVal upwards As Boolean, ByVal Slot As Byte)
  7091.  
  7092.         '***************************************************
  7093.        'Author: Torres Patricio (Pato)
  7094.        'Last Modification: 06/14/09
  7095.        'Writes the "MoveBank" message to the outgoing data buffer
  7096.        '***************************************************
  7097.        With outgoingData
  7098.                 Call .WriteByte(ClientPacketID.MoveBank)
  7099.        
  7100.                 Call .WriteBoolean(upwards)
  7101.                 Call .WriteByte(Slot)
  7102.  
  7103.         End With
  7104.  
  7105. End Sub
  7106.  
  7107. ''
  7108. ' Writes the "ClanCodexUpdate" message to the outgoing data buffer.
  7109. '
  7110. ' @param    desc New description of the clan.
  7111. ' @param    codex New codex of the clan.
  7112. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7113.  
  7114. Public Sub WriteClanCodexUpdate(ByVal Desc As String, ByRef Codex() As String)
  7115.  
  7116.         '***************************************************
  7117.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7118.        'Last Modification: 05/17/06
  7119.        'Writes the "ClanCodexUpdate" message to the outgoing data buffer
  7120.        '***************************************************
  7121.        Dim Temp As String
  7122.  
  7123.         Dim i    As Long
  7124.    
  7125.         With outgoingData
  7126.                 Call .WriteByte(ClientPacketID.ClanCodexUpdate)
  7127.        
  7128.                 Call .WriteASCIIString(Desc)
  7129.        
  7130.                 For i = LBound(Codex()) To UBound(Codex())
  7131.                         Temp = Temp & Codex(i) & SEPARATOR
  7132.                 Next i
  7133.        
  7134.                 If Len(Temp) Then _
  7135.                    Temp = Left$(Temp, Len(Temp) - 1)
  7136.        
  7137.                 Call .WriteASCIIString(Temp)
  7138.  
  7139.         End With
  7140.  
  7141. End Sub
  7142.  
  7143. ''
  7144. ' Writes the "UserCommerceOffer" message to the outgoing data buffer.
  7145. '
  7146. ' @param    slot Position within user inventory in which the desired item is.
  7147. ' @param    amount Number of items to offer.
  7148. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7149.  
  7150. Public Sub WriteUserCommerceOffer(ByVal Slot As Byte, _
  7151.                                   ByVal Amount As Long, _
  7152.                                   ByVal OfferSlot As Byte)
  7153.  
  7154.         '***************************************************
  7155.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7156.        'Last Modification: 05/17/06
  7157.        'Writes the "UserCommerceOffer" message to the outgoing data buffer
  7158.        '***************************************************
  7159.        With outgoingData
  7160.                 Call .WriteByte(ClientPacketID.UserCommerceOffer)
  7161.        
  7162.                 Call .WriteByte(Slot)
  7163.                 Call .WriteLong(Amount)
  7164.                 Call .WriteByte(OfferSlot)
  7165.  
  7166.         End With
  7167.  
  7168. End Sub
  7169.  
  7170. Public Sub WriteCommerceChat(ByVal chat As String)
  7171.  
  7172.         '***************************************************
  7173.        'Author: ZaMa
  7174.        'Last Modification: 03/12/2009
  7175.        'Writes the "CommerceChat" message to the outgoing data buffer
  7176.        '***************************************************
  7177.        With outgoingData
  7178.                 Call .WriteByte(ClientPacketID.CommerceChat)
  7179.        
  7180.                 Call .WriteASCIIString(chat)
  7181.  
  7182.         End With
  7183.  
  7184. End Sub
  7185.  
  7186. ''
  7187. ' Writes the "GuildAcceptPeace" message to the outgoing data buffer.
  7188. '
  7189. ' @param    guild The guild whose peace offer is accepted.
  7190. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7191.  
  7192. Public Sub WriteGuildAcceptPeace(ByVal guild As String)
  7193.  
  7194.         '***************************************************
  7195.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7196.        'Last Modification: 05/17/06
  7197.        'Writes the "GuildAcceptPeace" message to the outgoing data buffer
  7198.        '***************************************************
  7199.        With outgoingData
  7200.                 Call .WriteByte(ClientPacketID.GuildAcceptPeace)
  7201.        
  7202.                 Call .WriteASCIIString(guild)
  7203.  
  7204.         End With
  7205.  
  7206. End Sub
  7207.  
  7208. ''
  7209. ' Writes the "GuildRejectAlliance" message to the outgoing data buffer.
  7210. '
  7211. ' @param    guild The guild whose aliance offer is rejected.
  7212. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7213.  
  7214. Public Sub WriteGuildRejectAlliance(ByVal guild As String)
  7215.  
  7216.         '***************************************************
  7217.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7218.        'Last Modification: 05/17/06
  7219.        'Writes the "GuildRejectAlliance" message to the outgoing data buffer
  7220.        '***************************************************
  7221.        With outgoingData
  7222.                 Call .WriteByte(ClientPacketID.GuildRejectAlliance)
  7223.        
  7224.                 Call .WriteASCIIString(guild)
  7225.  
  7226.         End With
  7227.  
  7228. End Sub
  7229.  
  7230. ''
  7231. ' Writes the "GuildRejectPeace" message to the outgoing data buffer.
  7232. '
  7233. ' @param    guild The guild whose peace offer is rejected.
  7234. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7235.  
  7236. Public Sub WriteGuildRejectPeace(ByVal guild As String)
  7237.  
  7238.         '***************************************************
  7239.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7240.        'Last Modification: 05/17/06
  7241.        'Writes the "GuildRejectPeace" message to the outgoing data buffer
  7242.        '***************************************************
  7243.        With outgoingData
  7244.                 Call .WriteByte(ClientPacketID.GuildRejectPeace)
  7245.        
  7246.                 Call .WriteASCIIString(guild)
  7247.  
  7248.         End With
  7249.  
  7250. End Sub
  7251.  
  7252. ''
  7253. ' Writes the "GuildAcceptAlliance" message to the outgoing data buffer.
  7254. '
  7255. ' @param    guild The guild whose aliance offer is accepted.
  7256. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7257.  
  7258. Public Sub WriteGuildAcceptAlliance(ByVal guild As String)
  7259.  
  7260.         '***************************************************
  7261.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7262.        'Last Modification: 05/17/06
  7263.        'Writes the "GuildAcceptAlliance" message to the outgoing data buffer
  7264.        '***************************************************
  7265.        With outgoingData
  7266.                 Call .WriteByte(ClientPacketID.GuildAcceptAlliance)
  7267.        
  7268.                 Call .WriteASCIIString(guild)
  7269.  
  7270.         End With
  7271.  
  7272. End Sub
  7273.  
  7274. ''
  7275. ' Writes the "GuildOfferPeace" message to the outgoing data buffer.
  7276. '
  7277. ' @param    guild The guild to whom peace is offered.
  7278. ' @param    proposal The text to send with the proposal.
  7279. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7280.  
  7281. Public Sub WriteGuildOfferPeace(ByVal guild As String, ByVal proposal As String)
  7282.  
  7283.         '***************************************************
  7284.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7285.        'Last Modification: 05/17/06
  7286.        'Writes the "GuildOfferPeace" message to the outgoing data buffer
  7287.        '***************************************************
  7288.        With outgoingData
  7289.                 Call .WriteByte(ClientPacketID.GuildOfferPeace)
  7290.        
  7291.                 Call .WriteASCIIString(guild)
  7292.                 Call .WriteASCIIString(proposal)
  7293.  
  7294.         End With
  7295.  
  7296. End Sub
  7297.  
  7298. ''
  7299. ' Writes the "GuildOfferAlliance" message to the outgoing data buffer.
  7300. '
  7301. ' @param    guild The guild to whom an aliance is offered.
  7302. ' @param    proposal The text to send with the proposal.
  7303. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7304.  
  7305. Public Sub WriteGuildOfferAlliance(ByVal guild As String, ByVal proposal As String)
  7306.  
  7307.         '***************************************************
  7308.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7309.        'Last Modification: 05/17/06
  7310.        'Writes the "GuildOfferAlliance" message to the outgoing data buffer
  7311.        '***************************************************
  7312.        With outgoingData
  7313.                 Call .WriteByte(ClientPacketID.GuildOfferAlliance)
  7314.        
  7315.                 Call .WriteASCIIString(guild)
  7316.                 Call .WriteASCIIString(proposal)
  7317.  
  7318.         End With
  7319.  
  7320. End Sub
  7321.  
  7322. ''
  7323. ' Writes the "GuildAllianceDetails" message to the outgoing data buffer.
  7324. '
  7325. ' @param    guild The guild whose aliance proposal's details are requested.
  7326. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7327.  
  7328. Public Sub WriteGuildAllianceDetails(ByVal guild As String)
  7329.  
  7330.         '***************************************************
  7331.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7332.        'Last Modification: 05/17/06
  7333.        'Writes the "GuildAllianceDetails" message to the outgoing data buffer
  7334.        '***************************************************
  7335.        With outgoingData
  7336.                 Call .WriteByte(ClientPacketID.GuildAllianceDetails)
  7337.        
  7338.                 Call .WriteASCIIString(guild)
  7339.  
  7340.         End With
  7341.  
  7342. End Sub
  7343.  
  7344. ''
  7345. ' Writes the "GuildPeaceDetails" message to the outgoing data buffer.
  7346. '
  7347. ' @param    guild The guild whose peace proposal's details are requested.
  7348. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7349.  
  7350. Public Sub WriteGuildPeaceDetails(ByVal guild As String)
  7351.  
  7352.         '***************************************************
  7353.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7354.        'Last Modification: 05/17/06
  7355.        'Writes the "GuildPeaceDetails" message to the outgoing data buffer
  7356.        '***************************************************
  7357.        With outgoingData
  7358.                 Call .WriteByte(ClientPacketID.GuildPeaceDetails)
  7359.        
  7360.                 Call .WriteASCIIString(guild)
  7361.  
  7362.         End With
  7363.  
  7364. End Sub
  7365.  
  7366. ''
  7367. ' Writes the "GuildRequestJoinerInfo" message to the outgoing data buffer.
  7368. '
  7369. ' @param    username The user who wants to join the guild whose info is requested.
  7370. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7371.  
  7372. Public Sub WriteGuildRequestJoinerInfo(ByVal UserName As String)
  7373.  
  7374.         '***************************************************
  7375.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7376.        'Last Modification: 05/17/06
  7377.        'Writes the "GuildRequestJoinerInfo" message to the outgoing data buffer
  7378.        '***************************************************
  7379.        With outgoingData
  7380.                 Call .WriteByte(ClientPacketID.GuildRequestJoinerInfo)
  7381.        
  7382.                 Call .WriteASCIIString(UserName)
  7383.  
  7384.         End With
  7385.  
  7386. End Sub
  7387.  
  7388. ''
  7389. ' Writes the "GuildAlliancePropList" message to the outgoing data buffer.
  7390. '
  7391. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7392.  
  7393. Public Sub WriteGuildAlliancePropList()
  7394.         '***************************************************
  7395.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7396.        'Last Modification: 05/17/06
  7397.        'Writes the "GuildAlliancePropList" message to the outgoing data buffer
  7398.        '***************************************************
  7399.        Call outgoingData.WriteByte(ClientPacketID.GuildAlliancePropList)
  7400.  
  7401. End Sub
  7402.  
  7403. ''
  7404. ' Writes the "GuildPeacePropList" message to the outgoing data buffer.
  7405. '
  7406. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7407.  
  7408. Public Sub WriteGuildPeacePropList()
  7409.         '***************************************************
  7410.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7411.        'Last Modification: 05/17/06
  7412.        'Writes the "GuildPeacePropList" message to the outgoing data buffer
  7413.        '***************************************************
  7414.        Call outgoingData.WriteByte(ClientPacketID.GuildPeacePropList)
  7415.  
  7416. End Sub
  7417.  
  7418. ''
  7419. ' Writes the "GuildDeclareWar" message to the outgoing data buffer.
  7420. '
  7421. ' @param    guild The guild to which to declare war.
  7422. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7423.  
  7424. Public Sub WriteGuildDeclareWar(ByVal guild As String)
  7425.  
  7426.         '***************************************************
  7427.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7428.        'Last Modification: 05/17/06
  7429.        'Writes the "GuildDeclareWar" message to the outgoing data buffer
  7430.        '***************************************************
  7431.        With outgoingData
  7432.                 Call .WriteByte(ClientPacketID.GuildDeclareWar)
  7433.        
  7434.                 Call .WriteASCIIString(guild)
  7435.  
  7436.         End With
  7437.  
  7438. End Sub
  7439.  
  7440. ''
  7441. ' Writes the "GuildNewWebsite" message to the outgoing data buffer.
  7442. '
  7443. ' @param    url The guild's new website's URL.
  7444. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7445.  
  7446. Public Sub WriteGuildNewWebsite(ByVal URL As String)
  7447.  
  7448.         '***************************************************
  7449.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7450.        'Last Modification: 05/17/06
  7451.        'Writes the "GuildNewWebsite" message to the outgoing data buffer
  7452.        '***************************************************
  7453.        With outgoingData
  7454.                 Call .WriteByte(ClientPacketID.GuildNewWebsite)
  7455.        
  7456.                 Call .WriteASCIIString(URL)
  7457.  
  7458.         End With
  7459.  
  7460. End Sub
  7461.  
  7462. ''
  7463. ' Writes the "GuildAcceptNewMember" message to the outgoing data buffer.
  7464. '
  7465. ' @param    username The name of the accepted player.
  7466. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7467.  
  7468. Public Sub WriteGuildAcceptNewMember(ByVal UserName As String)
  7469.  
  7470.         '***************************************************
  7471.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7472.        'Last Modification: 05/17/06
  7473.        'Writes the "GuildAcceptNewMember" message to the outgoing data buffer
  7474.        '***************************************************
  7475.        With outgoingData
  7476.                 Call .WriteByte(ClientPacketID.GuildAcceptNewMember)
  7477.        
  7478.                 Call .WriteASCIIString(UserName)
  7479.  
  7480.         End With
  7481.  
  7482. End Sub
  7483.  
  7484. ''
  7485. ' Writes the "GuildRejectNewMember" message to the outgoing data buffer.
  7486. '
  7487. ' @param    username The name of the rejected player.
  7488. ' @param    reason The reason for which the player was rejected.
  7489. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7490.  
  7491. Public Sub WriteGuildRejectNewMember(ByVal UserName As String, ByVal reason As String)
  7492.  
  7493.         '***************************************************
  7494.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7495.        'Last Modification: 05/17/06
  7496.        'Writes the "GuildRejectNewMember" message to the outgoing data buffer
  7497.        '***************************************************
  7498.        With outgoingData
  7499.                 Call .WriteByte(ClientPacketID.GuildRejectNewMember)
  7500.        
  7501.                 Call .WriteASCIIString(UserName)
  7502.                 Call .WriteASCIIString(reason)
  7503.  
  7504.         End With
  7505.  
  7506. End Sub
  7507.  
  7508. ''
  7509. ' Writes the "GuildKickMember" message to the outgoing data buffer.
  7510. '
  7511. ' @param    username The name of the kicked player.
  7512. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7513.  
  7514. Public Sub WriteGuildKickMember(ByVal UserName As String)
  7515.  
  7516.         '***************************************************
  7517.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7518.        'Last Modification: 05/17/06
  7519.        'Writes the "GuildKickMember" message to the outgoing data buffer
  7520.        '***************************************************
  7521.        With outgoingData
  7522.                 Call .WriteByte(ClientPacketID.GuildKickMember)
  7523.        
  7524.                 Call .WriteASCIIString(UserName)
  7525.  
  7526.         End With
  7527.  
  7528. End Sub
  7529.  
  7530. ''
  7531. ' Writes the "GuildUpdateNews" message to the outgoing data buffer.
  7532. '
  7533. ' @param    news The news to be posted.
  7534. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7535.  
  7536. Public Sub WriteGuildUpdateNews(ByVal news As String)
  7537.  
  7538.         '***************************************************
  7539.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7540.        'Last Modification: 05/17/06
  7541.        'Writes the "GuildUpdateNews" message to the outgoing data buffer
  7542.        '***************************************************
  7543.        With outgoingData
  7544.                 Call .WriteByte(ClientPacketID.GuildUpdateNews)
  7545.        
  7546.                 Call .WriteASCIIString(news)
  7547.  
  7548.         End With
  7549.  
  7550. End Sub
  7551.  
  7552. ''
  7553. ' Writes the "GuildMemberInfo" message to the outgoing data buffer.
  7554. '
  7555. ' @param    username The user whose info is requested.
  7556. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7557.  
  7558. Public Sub WriteGuildMemberInfo(ByVal UserName As String)
  7559.  
  7560.         '***************************************************
  7561.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7562.        'Last Modification: 05/17/06
  7563.        'Writes the "GuildMemberInfo" message to the outgoing data buffer
  7564.        '***************************************************
  7565.        With outgoingData
  7566.                 Call .WriteByte(ClientPacketID.GuildMemberInfo)
  7567.        
  7568.                 Call .WriteASCIIString(UserName)
  7569.  
  7570.         End With
  7571.  
  7572. End Sub
  7573.  
  7574. ''
  7575. ' Writes the "GuildOpenElections" message to the outgoing data buffer.
  7576. '
  7577. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7578.  
  7579. Public Sub WriteGuildOpenElections()
  7580.         '***************************************************
  7581.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7582.        'Last Modification: 05/17/06
  7583.        'Writes the "GuildOpenElections" message to the outgoing data buffer
  7584.        '***************************************************
  7585.        Call outgoingData.WriteByte(ClientPacketID.GuildOpenElections)
  7586.  
  7587. End Sub
  7588.  
  7589. ''
  7590. ' Writes the "GuildRequestMembership" message to the outgoing data buffer.
  7591. '
  7592. ' @param    guild The guild to which to request membership.
  7593. ' @param    application The user's application sheet.
  7594. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7595.  
  7596. Public Sub WriteGuildRequestMembership(ByVal guild As String, ByVal Application As String)
  7597.  
  7598.         '***************************************************
  7599.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7600.        'Last Modification: 05/17/06
  7601.        'Writes the "GuildRequestMembership" message to the outgoing data buffer
  7602.        '***************************************************
  7603.        With outgoingData
  7604.                 Call .WriteByte(ClientPacketID.GuildRequestMembership)
  7605.        
  7606.                 Call .WriteASCIIString(guild)
  7607.                 Call .WriteASCIIString(Application)
  7608.  
  7609.         End With
  7610.  
  7611. End Sub
  7612.  
  7613. ''
  7614. ' Writes the "GuildRequestDetails" message to the outgoing data buffer.
  7615. '
  7616. ' @param    guild The guild whose details are requested.
  7617. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7618.  
  7619. Public Sub WriteGuildRequestDetails(ByVal guild As String)
  7620.  
  7621.         '***************************************************
  7622.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7623.        'Last Modification: 05/17/06
  7624.        'Writes the "GuildRequestDetails" message to the outgoing data buffer
  7625.        '***************************************************
  7626.        With outgoingData
  7627.                 Call .WriteByte(ClientPacketID.GuildRequestDetails)
  7628.        
  7629.                 Call .WriteASCIIString(guild)
  7630.  
  7631.         End With
  7632.  
  7633. End Sub
  7634.  
  7635. ''
  7636. ' Writes the "Online" message to the outgoing data buffer.
  7637. '
  7638. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7639.  
  7640. Public Sub WriteOnline()
  7641.         '***************************************************
  7642.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7643.        'Last Modification: 05/17/06
  7644.        'Writes the "Online" message to the outgoing data buffer
  7645.        '***************************************************
  7646.        Call outgoingData.WriteByte(ClientPacketID.Online)
  7647.  
  7648. End Sub
  7649.  
  7650. ''
  7651. ' Writes the "Quit" message to the outgoing data buffer.
  7652. '
  7653. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7654.  
  7655. Public Sub WriteQuit()
  7656.         '***************************************************
  7657.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7658.        'Last Modification: 08/16/08
  7659.        'Writes the "Quit" message to the outgoing data buffer
  7660.        '***************************************************
  7661.        Call outgoingData.WriteByte(ClientPacketID.Quit)
  7662.  
  7663. End Sub
  7664.  
  7665. ''
  7666. ' Writes the "GuildLeave" message to the outgoing data buffer.
  7667. '
  7668. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7669.  
  7670. Public Sub WriteGuildLeave()
  7671.         '***************************************************
  7672.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7673.        'Last Modification: 05/17/06
  7674.        'Writes the "GuildLeave" message to the outgoing data buffer
  7675.        '***************************************************
  7676.        Call outgoingData.WriteByte(ClientPacketID.GuildLeave)
  7677.  
  7678. End Sub
  7679.  
  7680. ''
  7681. ' Writes the "RequestAccountState" message to the outgoing data buffer.
  7682. '
  7683. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7684.  
  7685. Public Sub WriteRequestAccountState()
  7686.         '***************************************************
  7687.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7688.        'Last Modification: 05/17/06
  7689.        'Writes the "RequestAccountState" message to the outgoing data buffer
  7690.        '***************************************************
  7691.        Call outgoingData.WriteByte(ClientPacketID.RequestAccountState)
  7692.  
  7693. End Sub
  7694.  
  7695. ''
  7696. ' Writes the "PetStand" message to the outgoing data buffer.
  7697. '
  7698. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7699.  
  7700. Public Sub WritePetStand()
  7701.         '***************************************************
  7702.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7703.        'Last Modification: 05/17/06
  7704.        'Writes the "PetStand" message to the outgoing data buffer
  7705.        '***************************************************
  7706.        Call outgoingData.WriteByte(ClientPacketID.PetStand)
  7707.  
  7708. End Sub
  7709.  
  7710. ''
  7711. ' Writes the "PetFollow" message to the outgoing data buffer.
  7712. '
  7713. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7714.  
  7715. Public Sub WritePetFollow()
  7716.         '***************************************************
  7717.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7718.        'Last Modification: 05/17/06
  7719.        'Writes the "PetFollow" message to the outgoing data buffer
  7720.        '***************************************************
  7721.        Call outgoingData.WriteByte(ClientPacketID.PetFollow)
  7722.  
  7723. End Sub
  7724.  
  7725. ''
  7726. ' Writes the "ReleasePet" message to the outgoing data buffer.
  7727. '
  7728. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7729.  
  7730. Public Sub WriteReleasePet()
  7731.         '***************************************************
  7732.        'Author: ZaMa
  7733.        'Last Modification: 18/11/2009
  7734.        'Writes the "ReleasePet" message to the outgoing data buffer
  7735.        '***************************************************
  7736.        Call outgoingData.WriteByte(ClientPacketID.ReleasePet)
  7737.  
  7738. End Sub
  7739.  
  7740. ''
  7741. ' Writes the "TrainList" message to the outgoing data buffer.
  7742. '
  7743. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7744.  
  7745. Public Sub WriteTrainList()
  7746.         '***************************************************
  7747.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7748.        'Last Modification: 05/17/06
  7749.        'Writes the "TrainList" message to the outgoing data buffer
  7750.        '***************************************************
  7751.        Call outgoingData.WriteByte(ClientPacketID.TrainList)
  7752.  
  7753. End Sub
  7754.  
  7755. ''
  7756. ' Writes the "Rest" message to the outgoing data buffer.
  7757. '
  7758. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7759.  
  7760. Public Sub WriteRest()
  7761.         '***************************************************
  7762.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7763.        'Last Modification: 05/17/06
  7764.        'Writes the "Rest" message to the outgoing data buffer
  7765.        '***************************************************
  7766.        Call outgoingData.WriteByte(ClientPacketID.Rest)
  7767.  
  7768. End Sub
  7769.  
  7770. ''
  7771. ' Writes the "Meditate" message to the outgoing data buffer.
  7772. '
  7773. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7774.  
  7775. Public Sub WriteMeditate()
  7776.         '***************************************************
  7777.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7778.        'Last Modification: 05/17/06
  7779.        'Writes the "Meditate" message to the outgoing data buffer
  7780.        '***************************************************
  7781.        Call outgoingData.WriteByte(ClientPacketID.Meditate)
  7782.  
  7783. End Sub
  7784.  
  7785. ''
  7786. ' Writes the "Resucitate" message to the outgoing data buffer.
  7787. '
  7788. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7789.  
  7790. Public Sub WriteResucitate()
  7791.         '***************************************************
  7792.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7793.        'Last Modification: 05/17/06
  7794.        'Writes the "Resucitate" message to the outgoing data buffer
  7795.        '***************************************************
  7796.        Call outgoingData.WriteByte(ClientPacketID.Resucitate)
  7797.  
  7798. End Sub
  7799.  
  7800. ''
  7801. ' Writes the "Consultation" message to the outgoing data buffer.
  7802. '
  7803. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7804.  
  7805. Public Sub WriteConsultation()
  7806.         '***************************************************
  7807.        'Author: ZaMa
  7808.        'Last Modification: 01/05/2010
  7809.        'Writes the "Consultation" message to the outgoing data buffer
  7810.        '***************************************************
  7811.        Call outgoingData.WriteByte(ClientPacketID.Consultation)
  7812.  
  7813. End Sub
  7814.  
  7815. ''
  7816. ' Writes the "Heal" message to the outgoing data buffer.
  7817. '
  7818. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7819.  
  7820. Public Sub WriteHeal()
  7821.         '***************************************************
  7822.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7823.        'Last Modification: 05/17/06
  7824.        'Writes the "Heal" message to the outgoing data buffer
  7825.        '***************************************************
  7826.        Call outgoingData.WriteByte(ClientPacketID.Heal)
  7827.  
  7828. End Sub
  7829.  
  7830. ''
  7831. ' Writes the "Help" message to the outgoing data buffer.
  7832. '
  7833. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7834.  
  7835. Public Sub WriteHelp()
  7836.         '***************************************************
  7837.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7838.        'Last Modification: 05/17/06
  7839.        'Writes the "Help" message to the outgoing data buffer
  7840.        '***************************************************
  7841.        Call outgoingData.WriteByte(ClientPacketID.Help)
  7842.  
  7843. End Sub
  7844.  
  7845. ''
  7846. ' Writes the "RequestStats" message to the outgoing data buffer.
  7847. '
  7848. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7849.  
  7850. Public Sub WriteRequestStats()
  7851.         '***************************************************
  7852.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7853.        'Last Modification: 05/17/06
  7854.        'Writes the "RequestStats" message to the outgoing data buffer
  7855.        '***************************************************
  7856.        Call outgoingData.WriteByte(ClientPacketID.RequestStats)
  7857.  
  7858. End Sub
  7859.  
  7860. ''
  7861. ' Writes the "CommerceStart" message to the outgoing data buffer.
  7862. '
  7863. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7864.  
  7865. Public Sub WriteCommerceStart()
  7866.         '***************************************************
  7867.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7868.        'Last Modification: 05/17/06
  7869.        'Writes the "CommerceStart" message to the outgoing data buffer
  7870.        '***************************************************
  7871.        Call outgoingData.WriteByte(ClientPacketID.CommerceStart)
  7872.  
  7873. End Sub
  7874.  
  7875. ''
  7876. ' Writes the "BankStart" message to the outgoing data buffer.
  7877. '
  7878. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7879.  
  7880. Public Sub WriteBankStart()
  7881.         '***************************************************
  7882.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7883.        'Last Modification: 05/17/06
  7884.        'Writes the "BankStart" message to the outgoing data buffer
  7885.        '***************************************************
  7886.        Call outgoingData.WriteByte(ClientPacketID.BankStart)
  7887.  
  7888. End Sub
  7889.  
  7890. ''
  7891. ' Writes the "Enlist" message to the outgoing data buffer.
  7892. '
  7893. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7894.  
  7895. Public Sub WriteEnlist()
  7896.         '***************************************************
  7897.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7898.        'Last Modification: 05/17/06
  7899.        'Writes the "Enlist" message to the outgoing data buffer
  7900.        '***************************************************
  7901.        Call outgoingData.WriteByte(ClientPacketID.Enlist)
  7902.  
  7903. End Sub
  7904.  
  7905. ''
  7906. ' Writes the "Information" message to the outgoing data buffer.
  7907. '
  7908. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7909.  
  7910. Public Sub WriteInformation()
  7911.         '***************************************************
  7912.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7913.        'Last Modification: 05/17/06
  7914.        'Writes the "Information" message to the outgoing data buffer
  7915.        '***************************************************
  7916.        Call outgoingData.WriteByte(ClientPacketID.Information)
  7917.  
  7918. End Sub
  7919.  
  7920. ''
  7921. ' Writes the "Reward" message to the outgoing data buffer.
  7922. '
  7923. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7924.  
  7925. Public Sub WriteReward()
  7926.         '***************************************************
  7927.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7928.        'Last Modification: 05/17/06
  7929.        'Writes the "Reward" message to the outgoing data buffer
  7930.        '***************************************************
  7931.        Call outgoingData.WriteByte(ClientPacketID.Reward)
  7932.  
  7933. End Sub
  7934.  
  7935. ''
  7936. ' Writes the "RequestMOTD" message to the outgoing data buffer.
  7937. '
  7938. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7939.  
  7940. Public Sub WriteRequestMOTD()
  7941.         '***************************************************
  7942.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7943.        'Last Modification: 05/17/06
  7944.        'Writes the "RequestMOTD" message to the outgoing data buffer
  7945.        '***************************************************
  7946.        Call outgoingData.WriteByte(ClientPacketID.RequestMOTD)
  7947.  
  7948. End Sub
  7949.  
  7950. ''
  7951. ' Writes the "UpTime" message to the outgoing data buffer.
  7952. '
  7953. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7954.  
  7955. Public Sub WriteUpTime()
  7956.         '***************************************************
  7957.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7958.        'Last Modification: 05/17/06
  7959.        'Writes the "UpTime" message to the outgoing data buffer
  7960.        '***************************************************
  7961.        Call outgoingData.WriteByte(ClientPacketID.Uptime)
  7962.  
  7963. End Sub
  7964.  
  7965. ''
  7966. ' Writes the "PartyLeave" message to the outgoing data buffer.
  7967. '
  7968. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7969.  
  7970. Public Sub WritePartyLeave()
  7971.         '***************************************************
  7972.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7973.        'Last Modification: 05/17/06
  7974.        'Writes the "PartyLeave" message to the outgoing data buffer
  7975.        '***************************************************
  7976.        Call outgoingData.WriteByte(ClientPacketID.PartyLeave)
  7977.  
  7978. End Sub
  7979.  
  7980. ''
  7981. ' Writes the "PartyCreate" message to the outgoing data buffer.
  7982. '
  7983. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7984.  
  7985. Public Sub WritePartyCreate()
  7986.         '***************************************************
  7987.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7988.        'Last Modification: 05/17/06
  7989.        'Writes the "PartyCreate" message to the outgoing data buffer
  7990.        '***************************************************
  7991.        Call outgoingData.WriteByte(ClientPacketID.PartyCreate)
  7992.  
  7993. End Sub
  7994.  
  7995. ''
  7996. ' Writes the "PartyJoin" message to the outgoing data buffer.
  7997. '
  7998. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7999.  
  8000. Public Sub WritePartyJoin()
  8001.         '***************************************************
  8002.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8003.        'Last Modification: 05/17/06
  8004.        'Writes the "PartyJoin" message to the outgoing data buffer
  8005.        '***************************************************
  8006.        Call outgoingData.WriteByte(ClientPacketID.PartyJoin)
  8007.  
  8008. End Sub
  8009.  
  8010. ''
  8011. ' Writes the "Inquiry" message to the outgoing data buffer.
  8012. '
  8013. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8014.  
  8015. Public Sub WriteInquiry()
  8016.         '***************************************************
  8017.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8018.        'Last Modification: 05/17/06
  8019.        'Writes the "Inquiry" message to the outgoing data buffer
  8020.        '***************************************************
  8021.        Call outgoingData.WriteByte(ClientPacketID.Inquiry)
  8022.  
  8023. End Sub
  8024.  
  8025. ''
  8026. ' Writes the "GuildMessage" message to the outgoing data buffer.
  8027. '
  8028. ' @param    message The message to send to the guild.
  8029. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8030.  
  8031. Public Sub WriteGuildMessage(ByVal Message As String)
  8032.  
  8033.         '***************************************************
  8034.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8035.        'Last Modification: 05/17/06
  8036.        'Writes the "GuildRequestDetails" message to the outgoing data buffer
  8037.        '***************************************************
  8038.        With outgoingData
  8039.                 Call .WriteByte(ClientPacketID.GuildMessage)
  8040.        
  8041.                 Call .WriteASCIIString(Message)
  8042.  
  8043.         End With
  8044.  
  8045. End Sub
  8046.  
  8047. ''
  8048. ' Writes the "PartyMessage" message to the outgoing data buffer.
  8049. '
  8050. ' @param    message The message to send to the party.
  8051. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8052.  
  8053. Public Sub WritePartyMessage(ByVal Message As String)
  8054.  
  8055.         '***************************************************
  8056.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8057.        'Last Modification: 05/17/06
  8058.        'Writes the "PartyMessage" message to the outgoing data buffer
  8059.        '***************************************************
  8060.        With outgoingData
  8061.                 Call .WriteByte(ClientPacketID.PartyMessage)
  8062.        
  8063.                 Call .WriteASCIIString(Message)
  8064.  
  8065.         End With
  8066.  
  8067. End Sub
  8068.  
  8069. ''
  8070. ' Writes the "CentinelReport" message to the outgoing data buffer.
  8071. '
  8072. ' @param    number The number to report to the centinel.
  8073. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8074.  
  8075. Public Sub WriteCentinelReport(ByVal number As Integer)
  8076.  
  8077.         '***************************************************
  8078.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8079.        'Last Modification: 05/17/06
  8080.        'Writes the "CentinelReport" message to the outgoing data buffer
  8081.        '***************************************************
  8082.        With outgoingData
  8083.                 Call .WriteByte(ClientPacketID.CentinelReport)
  8084.        
  8085.                 Call .WriteInteger(number)
  8086.  
  8087.         End With
  8088.  
  8089. End Sub
  8090.  
  8091. ''
  8092. ' Writes the "GuildOnline" message to the outgoing data buffer.
  8093. '
  8094. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8095.  
  8096. Public Sub WriteGuildOnline()
  8097.         '***************************************************
  8098.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8099.        'Last Modification: 05/17/06
  8100.        'Writes the "GuildOnline" message to the outgoing data buffer
  8101.        '***************************************************
  8102.        Call outgoingData.WriteByte(ClientPacketID.GuildOnline)
  8103.  
  8104. End Sub
  8105.  
  8106. ''
  8107. ' Writes the "PartyOnline" message to the outgoing data buffer.
  8108. '
  8109. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8110.  
  8111. Public Sub WritePartyOnline()
  8112.         '***************************************************
  8113.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8114.        'Last Modification: 05/17/06
  8115.        'Writes the "PartyOnline" message to the outgoing data buffer
  8116.        '***************************************************
  8117.        Call outgoingData.WriteByte(ClientPacketID.PartyOnline)
  8118.  
  8119. End Sub
  8120.  
  8121. ''
  8122. ' Writes the "CouncilMessage" message to the outgoing data buffer.
  8123. '
  8124. ' @param    message The message to send to the other council members.
  8125. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8126.  
  8127. Public Sub WriteCouncilMessage(ByVal Message As String)
  8128.  
  8129.         '***************************************************
  8130.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8131.        'Last Modification: 05/17/06
  8132.        'Writes the "CouncilMessage" message to the outgoing data buffer
  8133.        '***************************************************
  8134.        With outgoingData
  8135.                 Call .WriteByte(ClientPacketID.CouncilMessage)
  8136.        
  8137.                 Call .WriteASCIIString(Message)
  8138.  
  8139.         End With
  8140.  
  8141. End Sub
  8142.  
  8143. ''
  8144. ' Writes the "RoleMasterRequest" message to the outgoing data buffer.
  8145. '
  8146. ' @param    message The message to send to the role masters.
  8147. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8148.  
  8149. Public Sub WriteRoleMasterRequest(ByVal Message As String)
  8150.  
  8151.         '***************************************************
  8152.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8153.        'Last Modification: 05/17/06
  8154.        'Writes the "RoleMasterRequest" message to the outgoing data buffer
  8155.        '***************************************************
  8156.        With outgoingData
  8157.                 Call .WriteByte(ClientPacketID.RoleMasterRequest)
  8158.        
  8159.                 Call .WriteASCIIString(Message)
  8160.  
  8161.         End With
  8162.  
  8163. End Sub
  8164.  
  8165. ''
  8166. ' Writes the "GMRequest" message to the outgoing data buffer.
  8167. '
  8168. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8169.  
  8170. Public Sub WriteGMRequest()
  8171.         '***************************************************
  8172.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8173.        'Last Modification: 05/17/06
  8174.        'Writes the "GMRequest" message to the outgoing data buffer
  8175.        '***************************************************
  8176.        Call outgoingData.WriteByte(ClientPacketID.GMRequest)
  8177.  
  8178. End Sub
  8179.  
  8180. ''
  8181. ' Writes the "BugReport" message to the outgoing data buffer.
  8182. '
  8183. ' @param    message The message explaining the reported bug.
  8184. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8185.  
  8186. Public Sub WriteBugReport(ByVal Message As String)
  8187.  
  8188.         '***************************************************
  8189.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8190.        'Last Modification: 05/17/06
  8191.        'Writes the "BugReport" message to the outgoing data buffer
  8192.        '***************************************************
  8193.        With outgoingData
  8194.                 Call .WriteByte(ClientPacketID.bugReport)
  8195.        
  8196.                 Call .WriteASCIIString(Message)
  8197.  
  8198.         End With
  8199.  
  8200. End Sub
  8201.  
  8202. ''
  8203. ' Writes the "ChangeDescription" message to the outgoing data buffer.
  8204. '
  8205. ' @param    desc The new description of the user's character.
  8206. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8207.  
  8208. Public Sub WriteChangeDescription(ByVal Desc As String)
  8209.  
  8210.         '***************************************************
  8211.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8212.        'Last Modification: 05/17/06
  8213.        'Writes the "ChangeDescription" message to the outgoing data buffer
  8214.        '***************************************************
  8215.        With outgoingData
  8216.                 Call .WriteByte(ClientPacketID.ChangeDescription)
  8217.        
  8218.                 Call .WriteASCIIString(Desc)
  8219.  
  8220.         End With
  8221.  
  8222. End Sub
  8223.  
  8224. ''
  8225. ' Writes the "GuildVote" message to the outgoing data buffer.
  8226. '
  8227. ' @param    username The user to vote for clan leader.
  8228. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8229.  
  8230. Public Sub WriteGuildVote(ByVal UserName As String)
  8231.  
  8232.         '***************************************************
  8233.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8234.        'Last Modification: 05/17/06
  8235.        'Writes the "GuildVote" message to the outgoing data buffer
  8236.        '***************************************************
  8237.        With outgoingData
  8238.                 Call .WriteByte(ClientPacketID.GuildVote)
  8239.        
  8240.                 Call .WriteASCIIString(UserName)
  8241.  
  8242.         End With
  8243.  
  8244. End Sub
  8245.  
  8246. ''
  8247. ' Writes the "Punishments" message to the outgoing data buffer.
  8248. '
  8249. ' @param    username The user whose's  punishments are requested.
  8250. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8251.  
  8252. Public Sub WritePunishments(ByVal UserName As String)
  8253.  
  8254.         '***************************************************
  8255.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8256.        'Last Modification: 05/17/06
  8257.        'Writes the "Punishments" message to the outgoing data buffer
  8258.        '***************************************************
  8259.        With outgoingData
  8260.                 Call .WriteByte(ClientPacketID.Punishments)
  8261.        
  8262.                 Call .WriteASCIIString(UserName)
  8263.  
  8264.         End With
  8265.  
  8266. End Sub
  8267.  
  8268. ''
  8269. ' Writes the "ChangePassword" message to the outgoing data buffer.
  8270. '
  8271. ' @param    oldPass Previous password.
  8272. ' @param    newPass New password.
  8273. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8274.  
  8275. Public Sub WriteChangePassword(ByRef oldPass As String, ByRef newPass As String)
  8276.  
  8277.         '***************************************************
  8278.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8279.        'Last Modification: 10/10/07
  8280.        'Last Modified By: Rapsodius
  8281.        'Writes the "ChangePassword" message to the outgoing data buffer
  8282.        '***************************************************
  8283.        With outgoingData
  8284.                 Call .WriteByte(ClientPacketID.ChangePassword)
  8285.          
  8286.                 Call .WriteASCIIString(oldPass)
  8287.                 Call .WriteASCIIString(newPass)
  8288.  
  8289.         End With
  8290.  
  8291. End Sub
  8292.  
  8293. ''
  8294. ' Writes the "Gamble" message to the outgoing data buffer.
  8295. '
  8296. ' @param    amount The amount to gamble.
  8297. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8298.  
  8299. Public Sub WriteGamble(ByVal Amount As Integer)
  8300.  
  8301.         '***************************************************
  8302.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8303.        'Last Modification: 05/17/06
  8304.        'Writes the "Gamble" message to the outgoing data buffer
  8305.        '***************************************************
  8306.        With outgoingData
  8307.                 Call .WriteByte(ClientPacketID.Gamble)
  8308.        
  8309.                 Call .WriteInteger(Amount)
  8310.  
  8311.         End With
  8312.  
  8313. End Sub
  8314.  
  8315. ''
  8316. ' Writes the "InquiryVote" message to the outgoing data buffer.
  8317. '
  8318. ' @param    opt The chosen option to vote for.
  8319. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8320.  
  8321. Public Sub WriteInquiryVote(ByVal opt As Byte)
  8322.  
  8323.         '***************************************************
  8324.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8325.        'Last Modification: 05/17/06
  8326.        'Writes the "InquiryVote" message to the outgoing data buffer
  8327.        '***************************************************
  8328.        With outgoingData
  8329.                 Call .WriteByte(ClientPacketID.InquiryVote)
  8330.        
  8331.                 Call .WriteByte(opt)
  8332.  
  8333.         End With
  8334.  
  8335. End Sub
  8336.  
  8337. ''
  8338. ' Writes the "LeaveFaction" message to the outgoing data buffer.
  8339. '
  8340. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8341.  
  8342. Public Sub WriteLeaveFaction()
  8343.         '***************************************************
  8344.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8345.        'Last Modification: 05/17/06
  8346.        'Writes the "LeaveFaction" message to the outgoing data buffer
  8347.        '***************************************************
  8348.        Call outgoingData.WriteByte(ClientPacketID.LeaveFaction)
  8349.  
  8350. End Sub
  8351.  
  8352. ''
  8353. ' Writes the "BankExtractGold" message to the outgoing data buffer.
  8354. '
  8355. ' @param    amount The amount of money to extract from the bank.
  8356. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8357.  
  8358. Public Sub WriteBankExtractGold(ByVal Amount As Long)
  8359.  
  8360.         '***************************************************
  8361.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8362.        'Last Modification: 05/17/06
  8363.        'Writes the "BankExtractGold" message to the outgoing data buffer
  8364.        '***************************************************
  8365.        With outgoingData
  8366.                 Call .WriteByte(ClientPacketID.BankExtractGold)
  8367.        
  8368.                 Call .WriteLong(Amount)
  8369.  
  8370.         End With
  8371.  
  8372. End Sub
  8373.  
  8374. ''
  8375. ' Writes the "BankDepositGold" message to the outgoing data buffer.
  8376. '
  8377. ' @param    amount The amount of money to deposit in the bank.
  8378. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8379.  
  8380. Public Sub WriteBankDepositGold(ByVal Amount As Long)
  8381.  
  8382.         '***************************************************
  8383.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8384.        'Last Modification: 05/17/06
  8385.        'Writes the "BankDepositGold" message to the outgoing data buffer
  8386.        '***************************************************
  8387.        With outgoingData
  8388.                 Call .WriteByte(ClientPacketID.BankDepositGold)
  8389.        
  8390.                 Call .WriteLong(Amount)
  8391.  
  8392.         End With
  8393.  
  8394. End Sub
  8395.  
  8396. ''
  8397. ' Writes the "Denounce" message to the outgoing data buffer.
  8398. '
  8399. ' @param    message The message to send with the denounce.
  8400. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8401.  
  8402. Public Sub WriteDenounce(ByVal Message As String)
  8403.  
  8404.         '***************************************************
  8405.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8406.        'Last Modification: 05/17/06
  8407.        'Writes the "Denounce" message to the outgoing data buffer
  8408.        '***************************************************
  8409.        With outgoingData
  8410.                 Call .WriteByte(ClientPacketID.Denounce)
  8411.        
  8412.                 Call .WriteASCIIString(Message)
  8413.  
  8414.         End With
  8415.  
  8416. End Sub
  8417.  
  8418. ''
  8419. ' Writes the "GuildFundate" message to the outgoing data buffer.
  8420. '
  8421. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8422.  
  8423. Public Sub WriteGuildFundate()
  8424.         '***************************************************
  8425.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8426.        'Last Modification: 03/21/2001
  8427.        'Writes the "GuildFundate" message to the outgoing data buffer
  8428.        '14/12/2009: ZaMa - Now first checks if the user can foundate a guild.
  8429.        '03/21/2001: Pato - Deleted de clanType param.
  8430.        '***************************************************
  8431.        Call outgoingData.WriteByte(ClientPacketID.GuildFundate)
  8432.  
  8433. End Sub
  8434.  
  8435. ''
  8436. ' Writes the "GuildFundation" message to the outgoing data buffer.
  8437. '
  8438. ' @param    clanType The alignment of the clan to be founded.
  8439. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8440.  
  8441. Public Sub WriteGuildFundation(ByVal clanType As eClanType)
  8442.  
  8443.         '***************************************************
  8444.        'Author: ZaMa
  8445.        'Last Modification: 14/12/2009
  8446.        'Writes the "GuildFundation" message to the outgoing data buffer
  8447.        '***************************************************
  8448.        With outgoingData
  8449.                 Call .WriteByte(ClientPacketID.GuildFundation)
  8450.        
  8451.                 Call .WriteByte(clanType)
  8452.  
  8453.         End With
  8454.  
  8455. End Sub
  8456.  
  8457. ''
  8458. ' Writes the "PartyKick" message to the outgoing data buffer.
  8459. '
  8460. ' @param    username The user to kick fro mthe party.
  8461. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8462.  
  8463. Public Sub WritePartyKick(ByVal UserName As String)
  8464.  
  8465.         '***************************************************
  8466.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8467.        'Last Modification: 05/17/06
  8468.        'Writes the "PartyKick" message to the outgoing data buffer
  8469.        '***************************************************
  8470.        With outgoingData
  8471.                 Call .WriteByte(ClientPacketID.PartyKick)
  8472.            
  8473.                 Call .WriteASCIIString(UserName)
  8474.  
  8475.         End With
  8476.  
  8477. End Sub
  8478.  
  8479. ''
  8480. ' Writes the "PartySetLeader" message to the outgoing data buffer.
  8481. '
  8482. ' @param    username The user to set as the party's leader.
  8483. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8484.  
  8485. Public Sub WritePartySetLeader(ByVal UserName As String)
  8486.  
  8487.         '***************************************************
  8488.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8489.        'Last Modification: 05/17/06
  8490.        'Writes the "PartySetLeader" message to the outgoing data buffer
  8491.        '***************************************************
  8492.        With outgoingData
  8493.                 Call .WriteByte(ClientPacketID.PartySetLeader)
  8494.        
  8495.                 Call .WriteASCIIString(UserName)
  8496.  
  8497.         End With
  8498.  
  8499. End Sub
  8500.  
  8501. ''
  8502. ' Writes the "PartyAcceptMember" message to the outgoing data buffer.
  8503. '
  8504. ' @param    username The user to accept into the party.
  8505. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8506.  
  8507. Public Sub WritePartyAcceptMember(ByVal UserName As String)
  8508.  
  8509.         '***************************************************
  8510.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8511.        'Last Modification: 05/17/06
  8512.        'Writes the "PartyAcceptMember" message to the outgoing data buffer
  8513.        '***************************************************
  8514.        With outgoingData
  8515.                 Call .WriteByte(ClientPacketID.PartyAcceptMember)
  8516.        
  8517.                 Call .WriteASCIIString(UserName)
  8518.  
  8519.         End With
  8520.  
  8521. End Sub
  8522.  
  8523. ''
  8524. ' Writes the "GuildMemberList" message to the outgoing data buffer.
  8525. '
  8526. ' @param    guild The guild whose member list is requested.
  8527. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8528.  
  8529. Public Sub WriteGuildMemberList(ByVal guild As String)
  8530.  
  8531.         '***************************************************
  8532.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8533.        'Last Modification: 05/17/06
  8534.        'Writes the "GuildMemberList" message to the outgoing data buffer
  8535.        '***************************************************
  8536.        With outgoingData
  8537.                 Call .WriteByte(ClientPacketID.GMCommands)
  8538.                 Call .WriteByte(eGMCommands.GuildMemberList)
  8539.        
  8540.                 Call .WriteASCIIString(guild)
  8541.  
  8542.         End With
  8543.  
  8544. End Sub
  8545.  
  8546. ''
  8547. ' Writes the "InitCrafting" message to the outgoing data buffer.
  8548. '
  8549. ' @param    Cantidad The final aumont of item to craft.
  8550. ' @param    NroPorCiclo The amount of items to craft per cicle.
  8551.  
  8552. Public Sub WriteInitCrafting(ByVal cantidad As Long, ByVal NroPorCiclo As Integer)
  8553.  
  8554.         '***************************************************
  8555.        'Author: ZaMa
  8556.        'Last Modification: 29/01/2010
  8557.        'Writes the "InitCrafting" message to the outgoing data buffer
  8558.        '***************************************************
  8559.        With outgoingData
  8560.                 Call .WriteByte(ClientPacketID.InitCrafting)
  8561.                 Call .WriteLong(cantidad)
  8562.        
  8563.                 Call .WriteInteger(NroPorCiclo)
  8564.  
  8565.         End With
  8566.  
  8567. End Sub
  8568.  
  8569. ''
  8570. ' Writes the "Home" message to the outgoing data buffer.
  8571. '
  8572. Public Sub WriteHome()
  8573.  
  8574.         '***************************************************
  8575.        'Author: Budi
  8576.        'Last Modification: 01/06/10
  8577.        'Writes the "Home" message to the outgoing data buffer
  8578.        '***************************************************
  8579.        With outgoingData
  8580.                 Call .WriteByte(ClientPacketID.Home)
  8581.  
  8582.         End With
  8583.  
  8584. End Sub
  8585.  
  8586. ''
  8587. ' Writes the "GMMessage" message to the outgoing data buffer.
  8588. '
  8589. ' @param    message The message to be sent to the other GMs online.
  8590. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8591.  
  8592. Public Sub WriteGMMessage(ByVal Message As String)
  8593.  
  8594.         '***************************************************
  8595.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8596.        'Last Modification: 05/17/06
  8597.        'Writes the "GMMessage" message to the outgoing data buffer
  8598.        '***************************************************
  8599.        With outgoingData
  8600.                 Call .WriteByte(ClientPacketID.GMCommands)
  8601.                 Call .WriteByte(eGMCommands.GMMessage)
  8602.                 Call .WriteASCIIString(Message)
  8603.  
  8604.         End With
  8605.  
  8606. End Sub
  8607.  
  8608. ''
  8609. ' Writes the "ShowName" message to the outgoing data buffer.
  8610. '
  8611. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8612.  
  8613. Public Sub WriteShowName()
  8614.         '***************************************************
  8615.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8616.        'Last Modification: 05/17/06
  8617.        'Writes the "ShowName" message to the outgoing data buffer
  8618.        '***************************************************
  8619.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8620.         Call outgoingData.WriteByte(eGMCommands.showName)
  8621.  
  8622. End Sub
  8623.  
  8624. ''
  8625. ' Writes the "OnlineRoyalArmy" message to the outgoing data buffer.
  8626. '
  8627. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8628.  
  8629. Public Sub WriteOnlineRoyalArmy()
  8630.         '***************************************************
  8631.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8632.        'Last Modification: 05/17/06
  8633.        'Writes the "OnlineRoyalArmy" message to the outgoing data buffer
  8634.        '***************************************************
  8635.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8636.         Call outgoingData.WriteByte(eGMCommands.OnlineRoyalArmy)
  8637.  
  8638. End Sub
  8639.  
  8640. ''
  8641. ' Writes the "OnlineChaosLegion" message to the outgoing data buffer.
  8642. '
  8643. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8644.  
  8645. Public Sub WriteOnlineChaosLegion()
  8646.         '***************************************************
  8647.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8648.        'Last Modification: 05/17/06
  8649.        'Writes the "OnlineChaosLegion" message to the outgoing data buffer
  8650.        '***************************************************
  8651.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8652.         Call outgoingData.WriteByte(eGMCommands.OnlineChaosLegion)
  8653.  
  8654. End Sub
  8655.  
  8656. ''
  8657. ' Writes the "GoNearby" message to the outgoing data buffer.
  8658. '
  8659. ' @param    username The suer to approach.
  8660. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8661.  
  8662. Public Sub WriteGoNearby(ByVal UserName As String)
  8663.  
  8664.         '***************************************************
  8665.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8666.        'Last Modification: 05/17/06
  8667.        'Writes the "GoNearby" message to the outgoing data buffer
  8668.        '***************************************************
  8669.        With outgoingData
  8670.                 Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8671.                 Call .WriteByte(eGMCommands.GoNearby)
  8672.        
  8673.                 Call .WriteASCIIString(UserName)
  8674.  
  8675.         End With
  8676.  
  8677. End Sub
  8678.  
  8679. ''
  8680. ' Writes the "Comment" message to the outgoing data buffer.
  8681. '
  8682. ' @param    message The message to leave in the log as a comment.
  8683. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8684.  
  8685. Public Sub WriteComment(ByVal Message As String)
  8686.  
  8687.         '***************************************************
  8688.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8689.        'Last Modification: 05/17/06
  8690.        'Writes the "Comment" message to the outgoing data buffer
  8691.        '***************************************************
  8692.        With outgoingData
  8693.                 Call .WriteByte(ClientPacketID.GMCommands)
  8694.                 Call .WriteByte(eGMCommands.Comment)
  8695.        
  8696.                 Call .WriteASCIIString(Message)
  8697.  
  8698.         End With
  8699.  
  8700. End Sub
  8701.  
  8702. ''
  8703. ' Writes the "ServerTime" message to the outgoing data buffer.
  8704. '
  8705. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8706.  
  8707. Public Sub WriteServerTime()
  8708.         '***************************************************
  8709.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8710.        'Last Modification: 05/17/06
  8711.        'Writes the "ServerTime" message to the outgoing data buffer
  8712.        '***************************************************
  8713.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8714.         Call outgoingData.WriteByte(eGMCommands.serverTime)
  8715.  
  8716. End Sub
  8717.  
  8718. ''
  8719. ' Writes the "Where" message to the outgoing data buffer.
  8720. '
  8721. ' @param    username The user whose position is requested.
  8722. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8723.  
  8724. Public Sub WriteWhere(ByVal UserName As String)
  8725.  
  8726.         '***************************************************
  8727.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8728.        'Last Modification: 05/17/06
  8729.        'Writes the "Where" message to the outgoing data buffer
  8730.        '***************************************************
  8731.        With outgoingData
  8732.                 Call .WriteByte(ClientPacketID.GMCommands)
  8733.                 Call .WriteByte(eGMCommands.Where)
  8734.        
  8735.                 Call .WriteASCIIString(UserName)
  8736.  
  8737.         End With
  8738.  
  8739. End Sub
  8740.  
  8741. ''
  8742. ' Writes the "CreaturesInMap" message to the outgoing data buffer.
  8743. '
  8744. ' @param    map The map in which to check for the existing creatures.
  8745. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8746.  
  8747. Public Sub WriteCreaturesInMap(ByVal Map As Integer)
  8748.  
  8749.         '***************************************************
  8750.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8751.        'Last Modification: 05/17/06
  8752.        'Writes the "CreaturesInMap" message to the outgoing data buffer
  8753.        '***************************************************
  8754.        With outgoingData
  8755.                 Call .WriteByte(ClientPacketID.GMCommands)
  8756.                 Call .WriteByte(eGMCommands.CreaturesInMap)
  8757.        
  8758.                 Call .WriteInteger(Map)
  8759.  
  8760.         End With
  8761.  
  8762. End Sub
  8763.  
  8764. ''
  8765. ' Writes the "WarpMeToTarget" message to the outgoing data buffer.
  8766. '
  8767. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8768.  
  8769. Public Sub WriteWarpMeToTarget()
  8770.         '***************************************************
  8771.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8772.        'Last Modification: 05/17/06
  8773.        'Writes the "WarpMeToTarget" message to the outgoing data buffer
  8774.        '***************************************************
  8775.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8776.         Call outgoingData.WriteByte(eGMCommands.WarpMeToTarget)
  8777.  
  8778. End Sub
  8779.  
  8780. ''
  8781. ' Writes the "WarpChar" message to the outgoing data buffer.
  8782. '
  8783. ' @param    username The user to be warped. "YO" represent's the user's char.
  8784. ' @param    map The map to which to warp the character.
  8785. ' @param    x The x position in the map to which to waro the character.
  8786. ' @param    y The y position in the map to which to waro the character.
  8787. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8788.  
  8789. Public Sub WriteWarpChar(ByVal UserName As String, _
  8790.                          ByVal Map As Integer, _
  8791.                          ByVal x As Byte, _
  8792.                          ByVal y As Byte)
  8793.  
  8794.         '***************************************************
  8795.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8796.        'Last Modification: 05/17/06
  8797.        'Writes the "WarpChar" message to the outgoing data buffer
  8798.        '***************************************************
  8799.        With outgoingData
  8800.                 Call .WriteByte(ClientPacketID.GMCommands)
  8801.                 Call .WriteByte(eGMCommands.WarpChar)
  8802.        
  8803.                 Call .WriteASCIIString(UserName)
  8804.        
  8805.                 Call .WriteInteger(Map)
  8806.        
  8807.                 Call .WriteByte(x)
  8808.                 Call .WriteByte(y)
  8809.  
  8810.         End With
  8811.  
  8812. End Sub
  8813.  
  8814. ''
  8815. ' Writes the "Silence" message to the outgoing data buffer.
  8816. '
  8817. ' @param    username The user to silence.
  8818. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8819.  
  8820. Public Sub WriteSilence(ByVal UserName As String)
  8821.  
  8822.         '***************************************************
  8823.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8824.        'Last Modification: 05/17/06
  8825.        'Writes the "Silence" message to the outgoing data buffer
  8826.        '***************************************************
  8827.        With outgoingData
  8828.                 Call .WriteByte(ClientPacketID.GMCommands)
  8829.                 Call .WriteByte(eGMCommands.Silence)
  8830.        
  8831.                 Call .WriteASCIIString(UserName)
  8832.  
  8833.         End With
  8834.  
  8835. End Sub
  8836.  
  8837. ''
  8838. ' Writes the "SOSShowList" message to the outgoing data buffer.
  8839. '
  8840. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8841.  
  8842. Public Sub WriteSOSShowList()
  8843.         '***************************************************
  8844.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8845.        'Last Modification: 05/17/06
  8846.        'Writes the "SOSShowList" message to the outgoing data buffer
  8847.        '***************************************************
  8848.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8849.         Call outgoingData.WriteByte(eGMCommands.SOSShowList)
  8850.  
  8851. End Sub
  8852.  
  8853. ''
  8854. ' Writes the "SOSRemove" message to the outgoing data buffer.
  8855. '
  8856. ' @param    username The user whose SOS call has been already attended.
  8857. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8858.  
  8859. Public Sub WriteSOSRemove(ByVal UserName As String)
  8860.  
  8861.         '***************************************************
  8862.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8863.        'Last Modification: 05/17/06
  8864.        'Writes the "SOSRemove" message to the outgoing data buffer
  8865.        '***************************************************
  8866.        With outgoingData
  8867.                 Call .WriteByte(ClientPacketID.GMCommands)
  8868.                 Call .WriteByte(eGMCommands.SOSRemove)
  8869.        
  8870.                 Call .WriteASCIIString(UserName)
  8871.  
  8872.         End With
  8873.  
  8874. End Sub
  8875.  
  8876. ''
  8877. ' Writes the "GoToChar" message to the outgoing data buffer.
  8878. '
  8879. ' @param    username The user to be approached.
  8880. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8881.  
  8882. Public Sub WriteGoToChar(ByVal UserName As String)
  8883.  
  8884.         '***************************************************
  8885.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8886.        'Last Modification: 05/17/06
  8887.        'Writes the "GoToChar" message to the outgoing data buffer
  8888.        '***************************************************
  8889.        With outgoingData
  8890.                 Call .WriteByte(ClientPacketID.GMCommands)
  8891.                 Call .WriteByte(eGMCommands.GoToChar)
  8892.        
  8893.                 Call .WriteASCIIString(UserName)
  8894.  
  8895.         End With
  8896.  
  8897. End Sub
  8898.  
  8899. ''
  8900. ' Writes the "invisible" message to the outgoing data buffer.
  8901. '
  8902. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8903.  
  8904. Public Sub WriteInvisible()
  8905.         '***************************************************
  8906.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8907.        'Last Modification: 05/17/06
  8908.        'Writes the "invisible" message to the outgoing data buffer
  8909.        '***************************************************
  8910.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8911.         Call outgoingData.WriteByte(eGMCommands.invisible)
  8912.  
  8913. End Sub
  8914.  
  8915. ''
  8916. ' Writes the "GMPanel" message to the outgoing data buffer.
  8917. '
  8918. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8919.  
  8920. Public Sub WriteGMPanel()
  8921.         '***************************************************
  8922.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8923.        'Last Modification: 05/17/06
  8924.        'Writes the "GMPanel" message to the outgoing data buffer
  8925.        '***************************************************
  8926.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8927.         Call outgoingData.WriteByte(eGMCommands.GMPanel)
  8928.  
  8929. End Sub
  8930.  
  8931. ''
  8932. ' Writes the "RequestUserList" message to the outgoing data buffer.
  8933. '
  8934. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8935.  
  8936. Public Sub WriteRequestUserList()
  8937.         '***************************************************
  8938.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8939.        'Last Modification: 05/17/06
  8940.        'Writes the "RequestUserList" message to the outgoing data buffer
  8941.        '***************************************************
  8942.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8943.         Call outgoingData.WriteByte(eGMCommands.RequestUserList)
  8944.  
  8945. End Sub
  8946.  
  8947. ''
  8948. ' Writes the "Working" message to the outgoing data buffer.
  8949. '
  8950. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8951.  
  8952. Public Sub WriteWorking()
  8953.         '***************************************************
  8954.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8955.        'Last Modification: 05/17/06
  8956.        'Writes the "Working" message to the outgoing data buffer
  8957.        '***************************************************
  8958.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8959.         Call outgoingData.WriteByte(eGMCommands.Working)
  8960.  
  8961. End Sub
  8962.  
  8963. ''
  8964. ' Writes the "Hiding" message to the outgoing data buffer.
  8965. '
  8966. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8967.  
  8968. Public Sub WriteHiding()
  8969.         '***************************************************
  8970.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8971.        'Last Modification: 05/17/06
  8972.        'Writes the "Hiding" message to the outgoing data buffer
  8973.        '***************************************************
  8974.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  8975.         Call outgoingData.WriteByte(eGMCommands.Hiding)
  8976.  
  8977. End Sub
  8978.  
  8979. ''
  8980. ' Writes the "Jail" message to the outgoing data buffer.
  8981. '
  8982. ' @param    username The user to be sent to jail.
  8983. ' @param    reason The reason for which to send him to jail.
  8984. ' @param    time The time (in minutes) the user will have to spend there.
  8985. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  8986.  
  8987. Public Sub WriteJail(ByVal UserName As String, ByVal reason As String, ByVal time As Byte)
  8988.  
  8989.         '***************************************************
  8990.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8991.        'Last Modification: 05/17/06
  8992.        'Writes the "Jail" message to the outgoing data buffer
  8993.        '***************************************************
  8994.        With outgoingData
  8995.                 Call .WriteByte(ClientPacketID.GMCommands)
  8996.                 Call .WriteByte(eGMCommands.Jail)
  8997.        
  8998.                 Call .WriteASCIIString(UserName)
  8999.                 Call .WriteASCIIString(reason)
  9000.        
  9001.                 Call .WriteByte(time)
  9002.  
  9003.         End With
  9004.  
  9005. End Sub
  9006.  
  9007. ''
  9008. ' Writes the "KillNPC" message to the outgoing data buffer.
  9009. '
  9010. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9011.  
  9012. Public Sub WriteKillNPC()
  9013.         '***************************************************
  9014.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9015.        'Last Modification: 05/17/06
  9016.        'Writes the "KillNPC" message to the outgoing data buffer
  9017.        '***************************************************
  9018.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9019.         Call outgoingData.WriteByte(eGMCommands.KillNPC)
  9020.  
  9021. End Sub
  9022.  
  9023. ''
  9024. ' Writes the "WarnUser" message to the outgoing data buffer.
  9025. '
  9026. ' @param    username The user to be warned.
  9027. ' @param    reason Reason for the warning.
  9028. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9029.  
  9030. Public Sub WriteWarnUser(ByVal UserName As String, ByVal reason As String)
  9031.  
  9032.         '***************************************************
  9033.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9034.        'Last Modification: 05/17/06
  9035.        'Writes the "WarnUser" message to the outgoing data buffer
  9036.        '***************************************************
  9037.        With outgoingData
  9038.                 Call .WriteByte(ClientPacketID.GMCommands)
  9039.                 Call .WriteByte(eGMCommands.WarnUser)
  9040.        
  9041.                 Call .WriteASCIIString(UserName)
  9042.                 Call .WriteASCIIString(reason)
  9043.  
  9044.         End With
  9045.  
  9046. End Sub
  9047.  
  9048. ''
  9049. ' Writes the "EditChar" message to the outgoing data buffer.
  9050. '
  9051. ' @param    UserName    The user to be edited.
  9052. ' @param    editOption  Indicates what to edit in the char.
  9053. ' @param    arg1        Additional argument 1. Contents depend on editoption.
  9054. ' @param    arg2        Additional argument 2. Contents depend on editoption.
  9055. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9056.  
  9057. Public Sub WriteEditChar(ByVal UserName As String, _
  9058.                          ByVal EditOption As eEditOptions, _
  9059.                          ByVal arg1 As String, _
  9060.                          ByVal arg2 As String)
  9061.  
  9062.         '***************************************************
  9063.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9064.        'Last Modification: 05/17/06
  9065.        'Writes the "EditChar" message to the outgoing data buffer
  9066.        '***************************************************
  9067.        With outgoingData
  9068.                 Call .WriteByte(ClientPacketID.GMCommands)
  9069.                 Call .WriteByte(eGMCommands.EditChar)
  9070.        
  9071.                 Call .WriteASCIIString(UserName)
  9072.        
  9073.                 Call .WriteByte(EditOption)
  9074.        
  9075.                 Call .WriteASCIIString(arg1)
  9076.                 Call .WriteASCIIString(arg2)
  9077.  
  9078.         End With
  9079.  
  9080. End Sub
  9081.  
  9082. ''
  9083. ' Writes the "RequestCharInfo" message to the outgoing data buffer.
  9084. '
  9085. ' @param    username The user whose information is requested.
  9086. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9087.  
  9088. Public Sub WriteRequestCharInfo(ByVal UserName As String)
  9089.  
  9090.         '***************************************************
  9091.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9092.        'Last Modification: 05/17/06
  9093.        'Writes the "RequestCharInfo" message to the outgoing data buffer
  9094.        '***************************************************
  9095.        With outgoingData
  9096.                 Call .WriteByte(ClientPacketID.GMCommands)
  9097.                 Call .WriteByte(eGMCommands.RequestCharInfo)
  9098.        
  9099.                 Call .WriteASCIIString(UserName)
  9100.  
  9101.         End With
  9102.  
  9103. End Sub
  9104.  
  9105. ''
  9106. ' Writes the "RequestCharStats" message to the outgoing data buffer.
  9107. '
  9108. ' @param    username The user whose stats are requested.
  9109. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9110.  
  9111. Public Sub WriteRequestCharStats(ByVal UserName As String)
  9112.  
  9113.         '***************************************************
  9114.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9115.        'Last Modification: 05/17/06
  9116.        'Writes the "RequestCharStats" message to the outgoing data buffer
  9117.        '***************************************************
  9118.        With outgoingData
  9119.                 Call .WriteByte(ClientPacketID.GMCommands)
  9120.                 Call .WriteByte(eGMCommands.RequestCharStats)
  9121.        
  9122.                 Call .WriteASCIIString(UserName)
  9123.  
  9124.         End With
  9125.  
  9126. End Sub
  9127.  
  9128. ''
  9129. ' Writes the "RequestCharGold" message to the outgoing data buffer.
  9130. '
  9131. ' @param    username The user whose gold is requested.
  9132. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9133.  
  9134. Public Sub WriteRequestCharGold(ByVal UserName As String)
  9135.  
  9136.         '***************************************************
  9137.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9138.        'Last Modification: 05/17/06
  9139.        'Writes the "RequestCharGold" message to the outgoing data buffer
  9140.        '***************************************************
  9141.        With outgoingData
  9142.                 Call .WriteByte(ClientPacketID.GMCommands)
  9143.                 Call .WriteByte(eGMCommands.RequestCharGold)
  9144.        
  9145.                 Call .WriteASCIIString(UserName)
  9146.  
  9147.         End With
  9148.  
  9149. End Sub
  9150.    
  9151. ''
  9152. ' Writes the "RequestCharInventory" message to the outgoing data buffer.
  9153. '
  9154. ' @param    username The user whose inventory is requested.
  9155. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9156.  
  9157. Public Sub WriteRequestCharInventory(ByVal UserName As String)
  9158.  
  9159.         '***************************************************
  9160.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9161.        'Last Modification: 05/17/06
  9162.        'Writes the "RequestCharInventory" message to the outgoing data buffer
  9163.        '***************************************************
  9164.        With outgoingData
  9165.                 Call .WriteByte(ClientPacketID.GMCommands)
  9166.                 Call .WriteByte(eGMCommands.RequestCharInventory)
  9167.        
  9168.                 Call .WriteASCIIString(UserName)
  9169.  
  9170.         End With
  9171.  
  9172. End Sub
  9173.  
  9174. ''
  9175. ' Writes the "RequestCharBank" message to the outgoing data buffer.
  9176. '
  9177. ' @param    username The user whose banking information is requested.
  9178. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9179.  
  9180. Public Sub WriteRequestCharBank(ByVal UserName As String)
  9181.  
  9182.         '***************************************************
  9183.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9184.        'Last Modification: 05/17/06
  9185.        'Writes the "RequestCharBank" message to the outgoing data buffer
  9186.        '***************************************************
  9187.        With outgoingData
  9188.                 Call .WriteByte(ClientPacketID.GMCommands)
  9189.                 Call .WriteByte(eGMCommands.RequestCharBank)
  9190.        
  9191.                 Call .WriteASCIIString(UserName)
  9192.  
  9193.         End With
  9194.  
  9195. End Sub
  9196.  
  9197. ''
  9198. ' Writes the "RequestCharSkills" message to the outgoing data buffer.
  9199. '
  9200. ' @param    username The user whose skills are requested.
  9201. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9202.  
  9203. Public Sub WriteRequestCharSkills(ByVal UserName As String)
  9204.  
  9205.         '***************************************************
  9206.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9207.        'Last Modification: 05/17/06
  9208.        'Writes the "RequestCharSkills" message to the outgoing data buffer
  9209.        '***************************************************
  9210.        With outgoingData
  9211.                 Call .WriteByte(ClientPacketID.GMCommands)
  9212.                 Call .WriteByte(eGMCommands.RequestCharSkills)
  9213.        
  9214.                 Call .WriteASCIIString(UserName)
  9215.  
  9216.         End With
  9217.  
  9218. End Sub
  9219.  
  9220. ''
  9221. ' Writes the "ReviveChar" message to the outgoing data buffer.
  9222. '
  9223. ' @param    username The user to eb revived.
  9224. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9225.  
  9226. Public Sub WriteReviveChar(ByVal UserName As String)
  9227.  
  9228.         '***************************************************
  9229.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9230.        'Last Modification: 05/17/06
  9231.        'Writes the "ReviveChar" message to the outgoing data buffer
  9232.        '***************************************************
  9233.        With outgoingData
  9234.                 Call .WriteByte(ClientPacketID.GMCommands)
  9235.                 Call .WriteByte(eGMCommands.ReviveChar)
  9236.        
  9237.                 Call .WriteASCIIString(UserName)
  9238.  
  9239.         End With
  9240.  
  9241. End Sub
  9242.  
  9243. ''
  9244. ' Writes the "OnlineGM" message to the outgoing data buffer.
  9245. '
  9246. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9247.  
  9248. Public Sub WriteOnlineGM()
  9249.         '***************************************************
  9250.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9251.        'Last Modification: 05/17/06
  9252.        'Writes the "OnlineGM" message to the outgoing data buffer
  9253.        '***************************************************
  9254.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9255.         Call outgoingData.WriteByte(eGMCommands.OnlineGM)
  9256.  
  9257. End Sub
  9258.  
  9259. ''
  9260. ' Writes the "OnlineMap" message to the outgoing data buffer.
  9261. '
  9262. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9263.  
  9264. Public Sub WriteOnlineMap(ByVal Map As Integer)
  9265.  
  9266.         '***************************************************
  9267.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9268.        'Last Modification: 26/03/2009
  9269.        'Writes the "OnlineMap" message to the outgoing data buffer
  9270.        '26/03/2009: Now you don't need to be in the map to use the comand, so you send the map to server
  9271.        '***************************************************
  9272.        With outgoingData
  9273.                 Call .WriteByte(ClientPacketID.GMCommands)
  9274.                 Call .WriteByte(eGMCommands.OnlineMap)
  9275.        
  9276.                 Call .WriteInteger(Map)
  9277.  
  9278.         End With
  9279.  
  9280. End Sub
  9281.  
  9282. ''
  9283. ' Writes the "Forgive" message to the outgoing data buffer.
  9284. '
  9285. ' @param    username The user to be forgiven.
  9286. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9287.  
  9288. Public Sub WriteForgive(ByVal UserName As String)
  9289.  
  9290.         '***************************************************
  9291.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9292.        'Last Modification: 05/17/06
  9293.        'Writes the "Forgive" message to the outgoing data buffer
  9294.        '***************************************************
  9295.        With outgoingData
  9296.                 Call .WriteByte(ClientPacketID.GMCommands)
  9297.                 Call .WriteByte(eGMCommands.Forgive)
  9298.        
  9299.                 Call .WriteASCIIString(UserName)
  9300.  
  9301.         End With
  9302.  
  9303. End Sub
  9304.  
  9305. ''
  9306. ' Writes the "Kick" message to the outgoing data buffer.
  9307. '
  9308. ' @param    username The user to be kicked.
  9309. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9310.  
  9311. Public Sub WriteKick(ByVal UserName As String)
  9312.  
  9313.         '***************************************************
  9314.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9315.        'Last Modification: 05/17/06
  9316.        'Writes the "Kick" message to the outgoing data buffer
  9317.        '***************************************************
  9318.        With outgoingData
  9319.                 Call .WriteByte(ClientPacketID.GMCommands)
  9320.                 Call .WriteByte(eGMCommands.Kick)
  9321.        
  9322.                 Call .WriteASCIIString(UserName)
  9323.  
  9324.         End With
  9325.  
  9326. End Sub
  9327.  
  9328. ''
  9329. ' Writes the "Execute" message to the outgoing data buffer.
  9330. '
  9331. ' @param    username The user to be executed.
  9332. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9333.  
  9334. Public Sub WriteExecute(ByVal UserName As String)
  9335.  
  9336.         '***************************************************
  9337.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9338.        'Last Modification: 05/17/06
  9339.        'Writes the "Execute" message to the outgoing data buffer
  9340.        '***************************************************
  9341.        With outgoingData
  9342.                 Call .WriteByte(ClientPacketID.GMCommands)
  9343.                 Call .WriteByte(eGMCommands.Execute)
  9344.        
  9345.                 Call .WriteASCIIString(UserName)
  9346.  
  9347.         End With
  9348.  
  9349. End Sub
  9350.  
  9351. ''
  9352. ' Writes the "BanChar" message to the outgoing data buffer.
  9353. '
  9354. ' @param    username The user to be banned.
  9355. ' @param    reason The reson for which the user is to be banned.
  9356. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9357.  
  9358. Public Sub WriteBanChar(ByVal UserName As String, ByVal reason As String)
  9359.  
  9360.         '***************************************************
  9361.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9362.        'Last Modification: 05/17/06
  9363.        'Writes the "BanChar" message to the outgoing data buffer
  9364.        '***************************************************
  9365.        With outgoingData
  9366.                 Call .WriteByte(ClientPacketID.GMCommands)
  9367.                 Call .WriteByte(eGMCommands.banChar)
  9368.        
  9369.                 Call .WriteASCIIString(UserName)
  9370.        
  9371.                 Call .WriteASCIIString(reason)
  9372.  
  9373.         End With
  9374.  
  9375. End Sub
  9376.  
  9377. ''
  9378. ' Writes the "UnbanChar" message to the outgoing data buffer.
  9379. '
  9380. ' @param    username The user to be unbanned.
  9381. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9382.  
  9383. Public Sub WriteUnbanChar(ByVal UserName As String)
  9384.  
  9385.         '***************************************************
  9386.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9387.        'Last Modification: 05/17/06
  9388.        'Writes the "UnbanChar" message to the outgoing data buffer
  9389.        '***************************************************
  9390.        With outgoingData
  9391.                 Call .WriteByte(ClientPacketID.GMCommands)
  9392.                 Call .WriteByte(eGMCommands.UnbanChar)
  9393.        
  9394.                 Call .WriteASCIIString(UserName)
  9395.  
  9396.         End With
  9397.  
  9398. End Sub
  9399.  
  9400. ''
  9401. ' Writes the "NPCFollow" message to the outgoing data buffer.
  9402. '
  9403. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9404.  
  9405. Public Sub WriteNPCFollow()
  9406.         '***************************************************
  9407.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9408.        'Last Modification: 05/17/06
  9409.        'Writes the "NPCFollow" message to the outgoing data buffer
  9410.        '***************************************************
  9411.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9412.         Call outgoingData.WriteByte(eGMCommands.NPCFollow)
  9413.  
  9414. End Sub
  9415.  
  9416. ''
  9417. ' Writes the "SummonChar" message to the outgoing data buffer.
  9418. '
  9419. ' @param    username The user to be summoned.
  9420. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9421.  
  9422. Public Sub WriteSummonChar(ByVal UserName As String)
  9423.  
  9424.         '***************************************************
  9425.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9426.        'Last Modification: 05/17/06
  9427.        'Writes the "SummonChar" message to the outgoing data buffer
  9428.        '***************************************************
  9429.        With outgoingData
  9430.                 Call .WriteByte(ClientPacketID.GMCommands)
  9431.                 Call .WriteByte(eGMCommands.SummonChar)
  9432.        
  9433.                 Call .WriteASCIIString(UserName)
  9434.  
  9435.         End With
  9436.  
  9437. End Sub
  9438.  
  9439. ''
  9440. ' Writes the "SpawnListRequest" message to the outgoing data buffer.
  9441. '
  9442. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9443.  
  9444. Public Sub WriteSpawnListRequest()
  9445.         '***************************************************
  9446.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9447.        'Last Modification: 05/17/06
  9448.        'Writes the "SpawnListRequest" message to the outgoing data buffer
  9449.        '***************************************************
  9450.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9451.         Call outgoingData.WriteByte(eGMCommands.SpawnListRequest)
  9452.  
  9453. End Sub
  9454.  
  9455. ''
  9456. ' Writes the "SpawnCreature" message to the outgoing data buffer.
  9457. '
  9458. ' @param    creatureIndex The index of the creature in the spawn list to be spawned.
  9459. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9460.  
  9461. Public Sub WriteSpawnCreature(ByVal creatureIndex As Integer)
  9462.  
  9463.         '***************************************************
  9464.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9465.        'Last Modification: 05/17/06
  9466.        'Writes the "SpawnCreature" message to the outgoing data buffer
  9467.        '***************************************************
  9468.        With outgoingData
  9469.                 Call .WriteByte(ClientPacketID.GMCommands)
  9470.                 Call .WriteByte(eGMCommands.SpawnCreature)
  9471.        
  9472.                 Call .WriteInteger(creatureIndex)
  9473.  
  9474.         End With
  9475.  
  9476. End Sub
  9477.  
  9478. ''
  9479. ' Writes the "ResetNPCInventory" message to the outgoing data buffer.
  9480. '
  9481. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9482.  
  9483. Public Sub WriteResetNPCInventory()
  9484.         '***************************************************
  9485.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9486.        'Last Modification: 05/17/06
  9487.        'Writes the "ResetNPCInventory" message to the outgoing data buffer
  9488.        '***************************************************
  9489.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9490.         Call outgoingData.WriteByte(eGMCommands.ResetNPCInventory)
  9491.  
  9492. End Sub
  9493.  
  9494. ''
  9495. ' Writes the "CleanWorld" message to the outgoing data buffer.
  9496. '
  9497. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9498.  
  9499. Public Sub WriteCleanWorld()
  9500.         '***************************************************
  9501.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9502.        'Last Modification: 05/17/06
  9503.        'Writes the "CleanWorld" message to the outgoing data buffer
  9504.        '***************************************************
  9505.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9506.         Call outgoingData.WriteByte(eGMCommands.CleanWorld)
  9507.  
  9508. End Sub
  9509.  
  9510. ''
  9511. ' Writes the "ServerMessage" message to the outgoing data buffer.
  9512. '
  9513. ' @param    message The message to be sent to players.
  9514. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9515.  
  9516. Public Sub WriteServerMessage(ByVal Message As String)
  9517.  
  9518.         '***************************************************
  9519.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9520.        'Last Modification: 05/17/06
  9521.        'Writes the "ServerMessage" message to the outgoing data buffer
  9522.        '***************************************************
  9523.        With outgoingData
  9524.                 Call .WriteByte(ClientPacketID.GMCommands)
  9525.                 Call .WriteByte(eGMCommands.ServerMessage)
  9526.        
  9527.                 Call .WriteASCIIString(Message)
  9528.  
  9529.         End With
  9530.  
  9531. End Sub
  9532.  
  9533. ''
  9534. ' Writes the "MapMessage" message to the outgoing data buffer.
  9535. '
  9536. ' @param    message The message to be sent to players.
  9537. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9538.  
  9539. Public Sub WriteMapMessage(ByVal Message As String)
  9540.  
  9541.         '***************************************************
  9542.        'Author: ZaMa
  9543.        'Last Modification: 14/11/2010
  9544.        'Writes the "MapMessage" message to the outgoing data buffer
  9545.        '***************************************************
  9546.        With outgoingData
  9547.                 Call .WriteByte(ClientPacketID.GMCommands)
  9548.                 Call .WriteByte(eGMCommands.MapMessage)
  9549.        
  9550.                 Call .WriteASCIIString(Message)
  9551.  
  9552.         End With
  9553.  
  9554. End Sub
  9555.  
  9556. ''
  9557. ' Writes the "NickToIP" message to the outgoing data buffer.
  9558. '
  9559. ' @param    username The user whose IP is requested.
  9560. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9561.  
  9562. Public Sub WriteNickToIP(ByVal UserName As String)
  9563.  
  9564.         '***************************************************
  9565.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9566.        'Last Modification: 05/17/06
  9567.        'Writes the "NickToIP" message to the outgoing data buffer
  9568.        '***************************************************
  9569.        With outgoingData
  9570.                 Call .WriteByte(ClientPacketID.GMCommands)
  9571.                 Call .WriteByte(eGMCommands.nickToIP)
  9572.        
  9573.                 Call .WriteASCIIString(UserName)
  9574.  
  9575.         End With
  9576.  
  9577. End Sub
  9578.  
  9579. ''
  9580. ' Writes the "IPToNick" message to the outgoing data buffer.
  9581. '
  9582. ' @param    IP The IP for which to search for players. Must be an array of 4 elements with the 4 components of the IP.
  9583. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9584.  
  9585. Public Sub WriteIPToNick(ByRef Ip() As Byte)
  9586.  
  9587.         '***************************************************
  9588.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9589.        'Last Modification: 05/17/06
  9590.        'Writes the "IPToNick" message to the outgoing data buffer
  9591.        '***************************************************
  9592.        If UBound(Ip()) - LBound(Ip()) + 1 <> 4 Then Exit Sub   'Invalid IP
  9593.    
  9594.         Dim i As Long
  9595.    
  9596.         With outgoingData
  9597.                 Call .WriteByte(ClientPacketID.GMCommands)
  9598.                 Call .WriteByte(eGMCommands.IPToNick)
  9599.        
  9600.                 For i = LBound(Ip()) To UBound(Ip())
  9601.                         Call .WriteByte(Ip(i))
  9602.                 Next i
  9603.  
  9604.         End With
  9605.  
  9606. End Sub
  9607.  
  9608. ''
  9609. ' Writes the "GuildOnlineMembers" message to the outgoing data buffer.
  9610. '
  9611. ' @param    guild The guild whose online player list is requested.
  9612. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9613.  
  9614. Public Sub WriteGuildOnlineMembers(ByVal guild As String)
  9615.  
  9616.         '***************************************************
  9617.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9618.        'Last Modification: 05/17/06
  9619.        'Writes the "GuildOnlineMembers" message to the outgoing data buffer
  9620.        '***************************************************
  9621.        With outgoingData
  9622.                 Call .WriteByte(ClientPacketID.GMCommands)
  9623.                 Call .WriteByte(eGMCommands.GuildOnlineMembers)
  9624.        
  9625.                 Call .WriteASCIIString(guild)
  9626.  
  9627.         End With
  9628.  
  9629. End Sub
  9630.  
  9631. ''
  9632. ' Writes the "TeleportCreate" message to the outgoing data buffer.
  9633. '
  9634. ' @param    map the map to which the teleport will lead.
  9635. ' @param    x The position in the x axis to which the teleport will lead.
  9636. ' @param    y The position in the y axis to which the teleport will lead.
  9637. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9638.  
  9639. Public Sub WriteTeleportCreate(ByVal Map As Integer, _
  9640.                                ByVal x As Byte, _
  9641.                                ByVal y As Byte, _
  9642.                                Optional ByVal Radio As Byte = 0)
  9643.  
  9644.         '***************************************************
  9645.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9646.        'Last Modification: 05/17/06
  9647.        'Writes the "TeleportCreate" message to the outgoing data buffer
  9648.        '***************************************************
  9649.        With outgoingData
  9650.                 Call .WriteByte(ClientPacketID.GMCommands)
  9651.                 Call .WriteByte(eGMCommands.TeleportCreate)
  9652.        
  9653.                 Call .WriteInteger(Map)
  9654.        
  9655.                 Call .WriteByte(x)
  9656.                 Call .WriteByte(y)
  9657.        
  9658.                 Call .WriteByte(Radio)
  9659.  
  9660.         End With
  9661.  
  9662. End Sub
  9663.  
  9664. ''
  9665. ' Writes the "TeleportDestroy" message to the outgoing data buffer.
  9666. '
  9667. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9668.  
  9669. Public Sub WriteTeleportDestroy()
  9670.         '***************************************************
  9671.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9672.        'Last Modification: 05/17/06
  9673.        'Writes the "TeleportDestroy" message to the outgoing data buffer
  9674.        '***************************************************
  9675.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9676.         Call outgoingData.WriteByte(eGMCommands.TeleportDestroy)
  9677.  
  9678. End Sub
  9679.  
  9680. ''
  9681. ' Writes the "RainToggle" message to the outgoing data buffer.
  9682. '
  9683. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9684.  
  9685. Public Sub WriteRainToggle()
  9686.         '***************************************************
  9687.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9688.        'Last Modification: 05/17/06
  9689.        'Writes the "RainToggle" message to the outgoing data buffer
  9690.        '***************************************************
  9691.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9692.         Call outgoingData.WriteByte(eGMCommands.RainToggle)
  9693.  
  9694. End Sub
  9695.  
  9696. ''
  9697. ' Writes the "SetCharDescription" message to the outgoing data buffer.
  9698. '
  9699. ' @param    desc The description to set to players.
  9700. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9701.  
  9702. Public Sub WriteSetCharDescription(ByVal Desc As String)
  9703.  
  9704.         '***************************************************
  9705.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9706.        'Last Modification: 05/17/06
  9707.        'Writes the "SetCharDescription" message to the outgoing data buffer
  9708.        '***************************************************
  9709.        With outgoingData
  9710.                 Call .WriteByte(ClientPacketID.GMCommands)
  9711.                 Call .WriteByte(eGMCommands.SetCharDescription)
  9712.        
  9713.                 Call .WriteASCIIString(Desc)
  9714.  
  9715.         End With
  9716.  
  9717. End Sub
  9718.  
  9719. ''
  9720. ' Writes the "ForceMIDIToMap" message to the outgoing data buffer.
  9721. '
  9722. ' @param    midiID The ID of the midi file to play.
  9723. ' @param    map The map in which to play the given midi.
  9724. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9725.  
  9726. Public Sub WriteForceMIDIToMap(ByVal midiID As Byte, ByVal Map As Integer)
  9727.  
  9728.         '***************************************************
  9729.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9730.        'Last Modification: 05/17/06
  9731.        'Writes the "ForceMIDIToMap" message to the outgoing data buffer
  9732.        '***************************************************
  9733.        With outgoingData
  9734.                 Call .WriteByte(ClientPacketID.GMCommands)
  9735.                 Call .WriteByte(eGMCommands.ForceMIDIToMap)
  9736.        
  9737.                 Call .WriteByte(midiID)
  9738.        
  9739.                 Call .WriteInteger(Map)
  9740.  
  9741.         End With
  9742.  
  9743. End Sub
  9744.  
  9745. ''
  9746. ' Writes the "ForceWAVEToMap" message to the outgoing data buffer.
  9747. '
  9748. ' @param    waveID  The ID of the wave file to play.
  9749. ' @param    Map     The map into which to play the given wave.
  9750. ' @param    x       The position in the x axis in which to play the given wave.
  9751. ' @param    y       The position in the y axis in which to play the given wave.
  9752. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9753.  
  9754. Public Sub WriteForceWAVEToMap(ByVal waveID As Byte, _
  9755.                                ByVal Map As Integer, _
  9756.                                ByVal x As Byte, _
  9757.                                ByVal y As Byte)
  9758.  
  9759.         '***************************************************
  9760.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9761.        'Last Modification: 05/17/06
  9762.        'Writes the "ForceWAVEToMap" message to the outgoing data buffer
  9763.        '***************************************************
  9764.        With outgoingData
  9765.                 Call .WriteByte(ClientPacketID.GMCommands)
  9766.                 Call .WriteByte(eGMCommands.ForceWAVEToMap)
  9767.        
  9768.                 Call .WriteByte(waveID)
  9769.        
  9770.                 Call .WriteInteger(Map)
  9771.        
  9772.                 Call .WriteByte(x)
  9773.                 Call .WriteByte(y)
  9774.  
  9775.         End With
  9776.  
  9777. End Sub
  9778.  
  9779. ''
  9780. ' Writes the "RoyalArmyMessage" message to the outgoing data buffer.
  9781. '
  9782. ' @param    message The message to send to the royal army members.
  9783. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9784.  
  9785. Public Sub WriteRoyalArmyMessage(ByVal Message As String)
  9786.  
  9787.         '***************************************************
  9788.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9789.        'Last Modification: 05/17/06
  9790.        'Writes the "RoyalArmyMessage" message to the outgoing data buffer
  9791.        '***************************************************
  9792.        With outgoingData
  9793.                 Call .WriteByte(ClientPacketID.GMCommands)
  9794.                 Call .WriteByte(eGMCommands.RoyalArmyMessage)
  9795.        
  9796.                 Call .WriteASCIIString(Message)
  9797.  
  9798.         End With
  9799.  
  9800. End Sub
  9801.  
  9802. ''
  9803. ' Writes the "ChaosLegionMessage" message to the outgoing data buffer.
  9804. '
  9805. ' @param    message The message to send to the chaos legion member.
  9806. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9807.  
  9808. Public Sub WriteChaosLegionMessage(ByVal Message As String)
  9809.  
  9810.         '***************************************************
  9811.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9812.        'Last Modification: 05/17/06
  9813.        'Writes the "ChaosLegionMessage" message to the outgoing data buffer
  9814.        '***************************************************
  9815.        With outgoingData
  9816.                 Call .WriteByte(ClientPacketID.GMCommands)
  9817.                 Call .WriteByte(eGMCommands.ChaosLegionMessage)
  9818.        
  9819.                 Call .WriteASCIIString(Message)
  9820.  
  9821.         End With
  9822.  
  9823. End Sub
  9824.  
  9825. ''
  9826. ' Writes the "CitizenMessage" message to the outgoing data buffer.
  9827. '
  9828. ' @param    message The message to send to citizens.
  9829. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9830.  
  9831. Public Sub WriteCitizenMessage(ByVal Message As String)
  9832.  
  9833.         '***************************************************
  9834.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9835.        'Last Modification: 05/17/06
  9836.        'Writes the "CitizenMessage" message to the outgoing data buffer
  9837.        '***************************************************
  9838.        With outgoingData
  9839.                 Call .WriteByte(ClientPacketID.GMCommands)
  9840.                 Call .WriteByte(eGMCommands.CitizenMessage)
  9841.        
  9842.                 Call .WriteASCIIString(Message)
  9843.  
  9844.         End With
  9845.  
  9846. End Sub
  9847.  
  9848. ''
  9849. ' Writes the "CriminalMessage" message to the outgoing data buffer.
  9850. '
  9851. ' @param    message The message to send to criminals.
  9852. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9853.  
  9854. Public Sub WriteCriminalMessage(ByVal Message As String)
  9855.  
  9856.         '***************************************************
  9857.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9858.        'Last Modification: 05/17/06
  9859.        'Writes the "CriminalMessage" message to the outgoing data buffer
  9860.        '***************************************************
  9861.        With outgoingData
  9862.                 Call .WriteByte(ClientPacketID.GMCommands)
  9863.                 Call .WriteByte(eGMCommands.CriminalMessage)
  9864.        
  9865.                 Call .WriteASCIIString(Message)
  9866.  
  9867.         End With
  9868.  
  9869. End Sub
  9870.  
  9871. ''
  9872. ' Writes the "TalkAsNPC" message to the outgoing data buffer.
  9873. '
  9874. ' @param    message The message to send to the royal army members.
  9875. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9876.  
  9877. Public Sub WriteTalkAsNPC(ByVal Message As String)
  9878.  
  9879.         '***************************************************
  9880.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9881.        'Last Modification: 05/17/06
  9882.        'Writes the "TalkAsNPC" message to the outgoing data buffer
  9883.        '***************************************************
  9884.        With outgoingData
  9885.                 Call .WriteByte(ClientPacketID.GMCommands)
  9886.                 Call .WriteByte(eGMCommands.TalkAsNPC)
  9887.        
  9888.                 Call .WriteASCIIString(Message)
  9889.  
  9890.         End With
  9891.  
  9892. End Sub
  9893.  
  9894. ''
  9895. ' Writes the "DestroyAllItemsInArea" message to the outgoing data buffer.
  9896. '
  9897. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9898.  
  9899. Public Sub WriteDestroyAllItemsInArea()
  9900.         '***************************************************
  9901.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9902.        'Last Modification: 05/17/06
  9903.        'Writes the "DestroyAllItemsInArea" message to the outgoing data buffer
  9904.        '***************************************************
  9905.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9906.         Call outgoingData.WriteByte(eGMCommands.DestroyAllItemsInArea)
  9907.  
  9908. End Sub
  9909.  
  9910. ''
  9911. ' Writes the "AcceptRoyalCouncilMember" message to the outgoing data buffer.
  9912. '
  9913. ' @param    username The name of the user to be accepted into the royal army council.
  9914. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9915.  
  9916. Public Sub WriteAcceptRoyalCouncilMember(ByVal UserName As String)
  9917.  
  9918.         '***************************************************
  9919.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9920.        'Last Modification: 05/17/06
  9921.        'Writes the "AcceptRoyalCouncilMember" message to the outgoing data buffer
  9922.        '***************************************************
  9923.        With outgoingData
  9924.                 Call .WriteByte(ClientPacketID.GMCommands)
  9925.                 Call .WriteByte(eGMCommands.AcceptRoyalCouncilMember)
  9926.        
  9927.                 Call .WriteASCIIString(UserName)
  9928.  
  9929.         End With
  9930.  
  9931. End Sub
  9932.  
  9933. ''
  9934. ' Writes the "AcceptChaosCouncilMember" message to the outgoing data buffer.
  9935. '
  9936. ' @param    username The name of the user to be accepted as a chaos council member.
  9937. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9938.  
  9939. Public Sub WriteAcceptChaosCouncilMember(ByVal UserName As String)
  9940.  
  9941.         '***************************************************
  9942.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9943.        'Last Modification: 05/17/06
  9944.        'Writes the "AcceptChaosCouncilMember" message to the outgoing data buffer
  9945.        '***************************************************
  9946.        With outgoingData
  9947.                 Call .WriteByte(ClientPacketID.GMCommands)
  9948.                 Call .WriteByte(eGMCommands.AcceptChaosCouncilMember)
  9949.        
  9950.                 Call .WriteASCIIString(UserName)
  9951.  
  9952.         End With
  9953.  
  9954. End Sub
  9955.  
  9956. ''
  9957. ' Writes the "ItemsInTheFloor" message to the outgoing data buffer.
  9958. '
  9959. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9960.  
  9961. Public Sub WriteItemsInTheFloor()
  9962.         '***************************************************
  9963.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9964.        'Last Modification: 05/17/06
  9965.        'Writes the "ItemsInTheFloor" message to the outgoing data buffer
  9966.        '***************************************************
  9967.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  9968.         Call outgoingData.WriteByte(eGMCommands.ItemsInTheFloor)
  9969.  
  9970. End Sub
  9971.  
  9972. ''
  9973. ' Writes the "MakeDumb" message to the outgoing data buffer.
  9974. '
  9975. ' @param    username The name of the user to be made dumb.
  9976. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  9977.  
  9978. Public Sub WriteMakeDumb(ByVal UserName As String)
  9979.  
  9980.         '***************************************************
  9981.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9982.        'Last Modification: 05/17/06
  9983.        'Writes the "MakeDumb" message to the outgoing data buffer
  9984.        '***************************************************
  9985.        With outgoingData
  9986.                 Call .WriteByte(ClientPacketID.GMCommands)
  9987.                 Call .WriteByte(eGMCommands.MakeDumb)
  9988.        
  9989.                 Call .WriteASCIIString(UserName)
  9990.  
  9991.         End With
  9992.  
  9993. End Sub
  9994.  
  9995. ''
  9996. ' Writes the "MakeDumbNoMore" message to the outgoing data buffer.
  9997. '
  9998. ' @param    username The name of the user who will no longer be dumb.
  9999. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10000.  
  10001. Public Sub WriteMakeDumbNoMore(ByVal UserName As String)
  10002.  
  10003.         '***************************************************
  10004.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10005.        'Last Modification: 05/17/06
  10006.        'Writes the "MakeDumbNoMore" message to the outgoing data buffer
  10007.        '***************************************************
  10008.        With outgoingData
  10009.                 Call .WriteByte(ClientPacketID.GMCommands)
  10010.                 Call .WriteByte(eGMCommands.MakeDumbNoMore)
  10011.        
  10012.                 Call .WriteASCIIString(UserName)
  10013.  
  10014.         End With
  10015.  
  10016. End Sub
  10017.  
  10018. ''
  10019. ' Writes the "DumpIPTables" message to the outgoing data buffer.
  10020. '
  10021. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10022.  
  10023. Public Sub WriteDumpIPTables()
  10024.         '***************************************************
  10025.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10026.        'Last Modification: 05/17/06
  10027.        'Writes the "DumpIPTables" message to the outgoing data buffer
  10028.        '***************************************************
  10029.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10030.         Call outgoingData.WriteByte(eGMCommands.dumpIPTables)
  10031.  
  10032. End Sub
  10033.  
  10034. ''
  10035. ' Writes the "CouncilKick" message to the outgoing data buffer.
  10036. '
  10037. ' @param    username The name of the user to be kicked from the council.
  10038. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10039.  
  10040. Public Sub WriteCouncilKick(ByVal UserName As String)
  10041.  
  10042.         '***************************************************
  10043.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10044.        'Last Modification: 05/17/06
  10045.        'Writes the "CouncilKick" message to the outgoing data buffer
  10046.        '***************************************************
  10047.        With outgoingData
  10048.                 Call .WriteByte(ClientPacketID.GMCommands)
  10049.                 Call .WriteByte(eGMCommands.CouncilKick)
  10050.        
  10051.                 Call .WriteASCIIString(UserName)
  10052.  
  10053.         End With
  10054.  
  10055. End Sub
  10056.  
  10057. ''
  10058. ' Writes the "SetTrigger" message to the outgoing data buffer.
  10059. '
  10060. ' @param    trigger The type of trigger to be set to the tile.
  10061. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10062.  
  10063. Public Sub WriteSetTrigger(ByVal Trigger As eTrigger)
  10064.  
  10065.         '***************************************************
  10066.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10067.        'Last Modification: 05/17/06
  10068.        'Writes the "SetTrigger" message to the outgoing data buffer
  10069.        '***************************************************
  10070.        With outgoingData
  10071.                 Call .WriteByte(ClientPacketID.GMCommands)
  10072.                 Call .WriteByte(eGMCommands.SetTrigger)
  10073.        
  10074.                 Call .WriteByte(Trigger)
  10075.  
  10076.         End With
  10077.  
  10078. End Sub
  10079.  
  10080. ''
  10081. ' Writes the "AskTrigger" message to the outgoing data buffer.
  10082. '
  10083. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10084.  
  10085. Public Sub WriteAskTrigger()
  10086.         '***************************************************
  10087.        'Author: Nicolas Matias Gonzalez (NIGO)
  10088.        'Last Modification: 04/13/07
  10089.        'Writes the "AskTrigger" message to the outgoing data buffer
  10090.        '***************************************************
  10091.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10092.         Call outgoingData.WriteByte(eGMCommands.AskTrigger)
  10093.  
  10094. End Sub
  10095.  
  10096. ''
  10097. ' Writes the "BannedIPList" message to the outgoing data buffer.
  10098. '
  10099. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10100.  
  10101. Public Sub WriteBannedIPList()
  10102.         '***************************************************
  10103.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10104.        'Last Modification: 05/17/06
  10105.        'Writes the "BannedIPList" message to the outgoing data buffer
  10106.        '***************************************************
  10107.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10108.         Call outgoingData.WriteByte(eGMCommands.BannedIPList)
  10109.  
  10110. End Sub
  10111.  
  10112. ''
  10113. ' Writes the "BannedIPReload" message to the outgoing data buffer.
  10114. '
  10115. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10116.  
  10117. Public Sub WriteBannedIPReload()
  10118.         '***************************************************
  10119.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10120.        'Last Modification: 05/17/06
  10121.        'Writes the "BannedIPReload" message to the outgoing data buffer
  10122.        '***************************************************
  10123.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10124.         Call outgoingData.WriteByte(eGMCommands.BannedIPReload)
  10125.  
  10126. End Sub
  10127.  
  10128. ''
  10129. ' Writes the "GuildBan" message to the outgoing data buffer.
  10130. '
  10131. ' @param    guild The guild whose members will be banned.
  10132. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10133.  
  10134. Public Sub WriteGuildBan(ByVal guild As String)
  10135.  
  10136.         '***************************************************
  10137.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10138.        'Last Modification: 05/17/06
  10139.        'Writes the "GuildBan" message to the outgoing data buffer
  10140.        '***************************************************
  10141.        With outgoingData
  10142.                 Call .WriteByte(ClientPacketID.GMCommands)
  10143.                 Call .WriteByte(eGMCommands.GuildBan)
  10144.        
  10145.                 Call .WriteASCIIString(guild)
  10146.  
  10147.         End With
  10148.  
  10149. End Sub
  10150.  
  10151. ''
  10152. ' Writes the "BanIP" message to the outgoing data buffer.
  10153. '
  10154. ' @param    byIp    If set to true, we are banning by IP, otherwise the ip of a given character.
  10155. ' @param    IP      The IP for which to search for players. Must be an array of 4 elements with the 4 components of the IP.
  10156. ' @param    nick    The nick of the player whose ip will be banned.
  10157. ' @param    reason  The reason for the ban.
  10158. '
  10159. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10160.  
  10161. Public Sub WriteBanIP(ByVal byIp As Boolean, _
  10162.                       ByRef Ip() As Byte, _
  10163.                       ByVal Nick As String, _
  10164.                       ByVal reason As String)
  10165.  
  10166.         '***************************************************
  10167.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10168.        'Last Modification: 05/17/06
  10169.        'Writes the "BanIP" message to the outgoing data buffer
  10170.        '***************************************************
  10171.        If byIp And UBound(Ip()) - LBound(Ip()) + 1 <> 4 Then Exit Sub   'Invalid IP
  10172.    
  10173.         Dim i As Long
  10174.    
  10175.         With outgoingData
  10176.                 Call .WriteByte(ClientPacketID.GMCommands)
  10177.                 Call .WriteByte(eGMCommands.BanIP)
  10178.        
  10179.                 Call .WriteBoolean(byIp)
  10180.        
  10181.                 If byIp Then
  10182.  
  10183.                         For i = LBound(Ip()) To UBound(Ip())
  10184.                                 Call .WriteByte(Ip(i))
  10185.                         Next i
  10186.  
  10187.                 Else
  10188.                         Call .WriteASCIIString(Nick)
  10189.  
  10190.                 End If
  10191.        
  10192.                 Call .WriteASCIIString(reason)
  10193.  
  10194.         End With
  10195.  
  10196. End Sub
  10197.  
  10198. ''
  10199. ' Writes the "UnbanIP" message to the outgoing data buffer.
  10200. '
  10201. ' @param    IP The IP for which to search for players. Must be an array of 4 elements with the 4 components of the IP.
  10202. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10203.  
  10204. Public Sub WriteUnbanIP(ByRef Ip() As Byte)
  10205.  
  10206.         '***************************************************
  10207.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10208.        'Last Modification: 05/17/06
  10209.        'Writes the "UnbanIP" message to the outgoing data buffer
  10210.        '***************************************************
  10211.        If UBound(Ip()) - LBound(Ip()) + 1 <> 4 Then Exit Sub   'Invalid IP
  10212.    
  10213.         Dim i As Long
  10214.    
  10215.         With outgoingData
  10216.                 Call .WriteByte(ClientPacketID.GMCommands)
  10217.                 Call .WriteByte(eGMCommands.UnbanIP)
  10218.        
  10219.                 For i = LBound(Ip()) To UBound(Ip())
  10220.                         Call .WriteByte(Ip(i))
  10221.                 Next i
  10222.  
  10223.         End With
  10224.  
  10225. End Sub
  10226.  
  10227. ''
  10228. ' Writes the "CreateItem" message to the outgoing data buffer.
  10229. '
  10230. ' @param    itemIndex The index of the item to be created.
  10231. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10232.  
  10233. Public Sub WriteCreateItem(ByVal ItemIndex As Long, ByVal Amount As Integer)
  10234.  
  10235.         '***************************************************
  10236.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10237.        'Last Modification: 05/17/06
  10238.        'Writes the "CreateItem" message to the outgoing data buffer
  10239.        '***************************************************
  10240.        With outgoingData
  10241.                 Call .WriteByte(ClientPacketID.GMCommands)
  10242.                 Call .WriteByte(eGMCommands.CreateItem)
  10243.                 Call .WriteInteger(ItemIndex)
  10244.                 Call .WriteInteger(Amount)
  10245.  
  10246.         End With
  10247.  
  10248. End Sub
  10249.  
  10250. ''
  10251. ' Writes the "DestroyItems" message to the outgoing data buffer.
  10252. '
  10253. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10254.  
  10255. Public Sub WriteDestroyItems()
  10256.         '***************************************************
  10257.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10258.        'Last Modification: 05/17/06
  10259.        'Writes the "DestroyItems" message to the outgoing data buffer
  10260.        '***************************************************
  10261.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10262.         Call outgoingData.WriteByte(eGMCommands.DestroyItems)
  10263.  
  10264. End Sub
  10265.  
  10266. ''
  10267. ' Writes the "ChaosLegionKick" message to the outgoing data buffer.
  10268. '
  10269. ' @param    username The name of the user to be kicked from the Chaos Legion.
  10270. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10271.  
  10272. Public Sub WriteChaosLegionKick(ByVal UserName As String)
  10273.  
  10274.         '***************************************************
  10275.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10276.        'Last Modification: 05/17/06
  10277.        'Writes the "ChaosLegionKick" message to the outgoing data buffer
  10278.        '***************************************************
  10279.        With outgoingData
  10280.                 Call .WriteByte(ClientPacketID.GMCommands)
  10281.                 Call .WriteByte(eGMCommands.ChaosLegionKick)
  10282.        
  10283.                 Call .WriteASCIIString(UserName)
  10284.  
  10285.         End With
  10286.  
  10287. End Sub
  10288.  
  10289. ''
  10290. ' Writes the "RoyalArmyKick" message to the outgoing data buffer.
  10291. '
  10292. ' @param    username The name of the user to be kicked from the Royal Army.
  10293. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10294.  
  10295. Public Sub WriteRoyalArmyKick(ByVal UserName As String)
  10296.  
  10297.         '***************************************************
  10298.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10299.        'Last Modification: 05/17/06
  10300.        'Writes the "RoyalArmyKick" message to the outgoing data buffer
  10301.        '***************************************************
  10302.        With outgoingData
  10303.                 Call .WriteByte(ClientPacketID.GMCommands)
  10304.                 Call .WriteByte(eGMCommands.RoyalArmyKick)
  10305.        
  10306.                 Call .WriteASCIIString(UserName)
  10307.  
  10308.         End With
  10309.  
  10310. End Sub
  10311.  
  10312. ''
  10313. ' Writes the "ForceMIDIAll" message to the outgoing data buffer.
  10314. '
  10315. ' @param    midiID The id of the midi file to play.
  10316. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10317.  
  10318. Public Sub WriteForceMIDIAll(ByVal midiID As Byte)
  10319.  
  10320.         '***************************************************
  10321.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10322.        'Last Modification: 05/17/06
  10323.        'Writes the "ForceMIDIAll" message to the outgoing data buffer
  10324.        '***************************************************
  10325.        With outgoingData
  10326.                 Call .WriteByte(ClientPacketID.GMCommands)
  10327.                 Call .WriteByte(eGMCommands.ForceMIDIAll)
  10328.        
  10329.                 Call .WriteByte(midiID)
  10330.  
  10331.         End With
  10332.  
  10333. End Sub
  10334.  
  10335. ''
  10336. ' Writes the "ForceWAVEAll" message to the outgoing data buffer.
  10337. '
  10338. ' @param    waveID The id of the wave file to play.
  10339. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10340.  
  10341. Public Sub WriteForceWAVEAll(ByVal waveID As Byte)
  10342.  
  10343.         '***************************************************
  10344.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10345.        'Last Modification: 05/17/06
  10346.        'Writes the "ForceWAVEAll" message to the outgoing data buffer
  10347.        '***************************************************
  10348.        With outgoingData
  10349.                 Call .WriteByte(ClientPacketID.GMCommands)
  10350.                 Call .WriteByte(eGMCommands.ForceWAVEAll)
  10351.        
  10352.                 Call .WriteByte(waveID)
  10353.  
  10354.         End With
  10355.  
  10356. End Sub
  10357.  
  10358. ''
  10359. ' Writes the "RemovePunishment" message to the outgoing data buffer.
  10360. '
  10361. ' @param    username The user whose punishments will be altered.
  10362. ' @param    punishment The id of the punishment to be removed.
  10363. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10364.  
  10365. Public Sub WriteRemovePunishment(ByVal UserName As String, _
  10366.                                  ByVal punishment As Byte, _
  10367.                                  ByVal NewText As String)
  10368.  
  10369.         '***************************************************
  10370.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10371.        'Last Modification: 05/17/06
  10372.        'Writes the "RemovePunishment" message to the outgoing data buffer
  10373.        '***************************************************
  10374.        With outgoingData
  10375.                 Call .WriteByte(ClientPacketID.GMCommands)
  10376.                 Call .WriteByte(eGMCommands.RemovePunishment)
  10377.        
  10378.                 Call .WriteASCIIString(UserName)
  10379.                 Call .WriteByte(punishment)
  10380.                 Call .WriteASCIIString(NewText)
  10381.  
  10382.         End With
  10383.  
  10384. End Sub
  10385.  
  10386. ''
  10387. ' Writes the "TileBlockedToggle" message to the outgoing data buffer.
  10388. '
  10389. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10390.  
  10391. Public Sub WriteTileBlockedToggle()
  10392.         '***************************************************
  10393.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10394.        'Last Modification: 05/17/06
  10395.        'Writes the "TileBlockedToggle" message to the outgoing data buffer
  10396.        '***************************************************
  10397.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10398.         Call outgoingData.WriteByte(eGMCommands.TileBlockedToggle)
  10399.  
  10400. End Sub
  10401.  
  10402. ''
  10403. ' Writes the "KillNPCNoRespawn" message to the outgoing data buffer.
  10404. '
  10405. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10406.  
  10407. Public Sub WriteKillNPCNoRespawn()
  10408.         '***************************************************
  10409.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10410.        'Last Modification: 05/17/06
  10411.        'Writes the "KillNPCNoRespawn" message to the outgoing data buffer
  10412.        '***************************************************
  10413.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10414.         Call outgoingData.WriteByte(eGMCommands.KillNPCNoRespawn)
  10415.  
  10416. End Sub
  10417.  
  10418. ''
  10419. ' Writes the "KillAllNearbyNPCs" message to the outgoing data buffer.
  10420. '
  10421. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10422.  
  10423. Public Sub WriteKillAllNearbyNPCs()
  10424.         '***************************************************
  10425.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10426.        'Last Modification: 05/17/06
  10427.        'Writes the "KillAllNearbyNPCs" message to the outgoing data buffer
  10428.        '***************************************************
  10429.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10430.         Call outgoingData.WriteByte(eGMCommands.KillAllNearbyNPCs)
  10431.  
  10432. End Sub
  10433.  
  10434. ''
  10435. ' Writes the "LastIP" message to the outgoing data buffer.
  10436. '
  10437. ' @param    username The user whose last IPs are requested.
  10438. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10439.  
  10440. Public Sub WriteLastIP(ByVal UserName As String)
  10441.  
  10442.         '***************************************************
  10443.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10444.        'Last Modification: 05/17/06
  10445.        'Writes the "LastIP" message to the outgoing data buffer
  10446.        '***************************************************
  10447.        With outgoingData
  10448.                 Call .WriteByte(ClientPacketID.GMCommands)
  10449.                 Call .WriteByte(eGMCommands.LastIP)
  10450.        
  10451.                 Call .WriteASCIIString(UserName)
  10452.  
  10453.         End With
  10454.  
  10455. End Sub
  10456.  
  10457. ''
  10458. ' Writes the "ChangeMOTD" message to the outgoing data buffer.
  10459. '
  10460. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10461.  
  10462. Public Sub WriteChangeMOTD()
  10463.         '***************************************************
  10464.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10465.        'Last Modification: 05/17/06
  10466.        'Writes the "ChangeMOTD" message to the outgoing data buffer
  10467.        '***************************************************
  10468.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10469.         Call outgoingData.WriteByte(eGMCommands.ChangeMOTD)
  10470.  
  10471. End Sub
  10472.  
  10473. ''
  10474. ' Writes the "SetMOTD" message to the outgoing data buffer.
  10475. '
  10476. ' @param    message The message to be set as the new MOTD.
  10477. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10478.  
  10479. Public Sub WriteSetMOTD(ByVal Message As String)
  10480.  
  10481.         '***************************************************
  10482.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10483.        'Last Modification: 05/17/06
  10484.        'Writes the "SetMOTD" message to the outgoing data buffer
  10485.        '***************************************************
  10486.        With outgoingData
  10487.                 Call .WriteByte(ClientPacketID.GMCommands)
  10488.                 Call .WriteByte(eGMCommands.SetMOTD)
  10489.        
  10490.                 Call .WriteASCIIString(Message)
  10491.  
  10492.         End With
  10493.  
  10494. End Sub
  10495.  
  10496. ''
  10497. ' Writes the "SystemMessage" message to the outgoing data buffer.
  10498. '
  10499. ' @param    message The message to be sent to all players.
  10500. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10501.  
  10502. Public Sub WriteSystemMessage(ByVal Message As String)
  10503.  
  10504.         '***************************************************
  10505.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10506.        'Last Modification: 05/17/06
  10507.        'Writes the "SystemMessage" message to the outgoing data buffer
  10508.        '***************************************************
  10509.        With outgoingData
  10510.                 Call .WriteByte(ClientPacketID.GMCommands)
  10511.                 Call .WriteByte(eGMCommands.SystemMessage)
  10512.        
  10513.                 Call .WriteASCIIString(Message)
  10514.  
  10515.         End With
  10516.  
  10517. End Sub
  10518.  
  10519. ''
  10520. ' Writes the "CreateNPC" message to the outgoing data buffer.
  10521. '
  10522. ' @param    npcIndex The index of the NPC to be created.
  10523. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10524.  
  10525. Public Sub WriteCreateNPC(ByVal NpcIndex As Integer)
  10526.  
  10527.         '***************************************************
  10528.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10529.        'Last Modification: 05/17/06
  10530.        'Writes the "CreateNPC" message to the outgoing data buffer
  10531.        '***************************************************
  10532.        With outgoingData
  10533.                 Call .WriteByte(ClientPacketID.GMCommands)
  10534.                 Call .WriteByte(eGMCommands.CreateNPC)
  10535.        
  10536.                 Call .WriteInteger(NpcIndex)
  10537.  
  10538.         End With
  10539.  
  10540. End Sub
  10541.  
  10542. ''
  10543. ' Writes the "CreateNPCWithRespawn" message to the outgoing data buffer.
  10544. '
  10545. ' @param    npcIndex The index of the NPC to be created.
  10546. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10547.  
  10548. Public Sub WriteCreateNPCWithRespawn(ByVal NpcIndex As Integer)
  10549.  
  10550.         '***************************************************
  10551.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10552.        'Last Modification: 05/17/06
  10553.        'Writes the "CreateNPCWithRespawn" message to the outgoing data buffer
  10554.        '***************************************************
  10555.        With outgoingData
  10556.                 Call .WriteByte(ClientPacketID.GMCommands)
  10557.                 Call .WriteByte(eGMCommands.CreateNPCWithRespawn)
  10558.        
  10559.                 Call .WriteInteger(NpcIndex)
  10560.  
  10561.         End With
  10562.  
  10563. End Sub
  10564.  
  10565. ''
  10566. ' Writes the "ImperialArmour" message to the outgoing data buffer.
  10567. '
  10568. ' @param    armourIndex The index of imperial armour to be altered.
  10569. ' @param    objectIndex The index of the new object to be set as the imperial armour.
  10570. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10571.  
  10572. Public Sub WriteImperialArmour(ByVal armourIndex As Byte, ByVal objectIndex As Integer)
  10573.  
  10574.         '***************************************************
  10575.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10576.        'Last Modification: 05/17/06
  10577.        'Writes the "ImperialArmour" message to the outgoing data buffer
  10578.        '***************************************************
  10579.        With outgoingData
  10580.                 Call .WriteByte(ClientPacketID.GMCommands)
  10581.                 Call .WriteByte(eGMCommands.ImperialArmour)
  10582.        
  10583.                 Call .WriteByte(armourIndex)
  10584.        
  10585.                 Call .WriteInteger(objectIndex)
  10586.  
  10587.         End With
  10588.  
  10589. End Sub
  10590.  
  10591. ''
  10592. ' Writes the "ChaosArmour" message to the outgoing data buffer.
  10593. '
  10594. ' @param    armourIndex The index of chaos armour to be altered.
  10595. ' @param    objectIndex The index of the new object to be set as the chaos armour.
  10596. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10597.  
  10598. Public Sub WriteChaosArmour(ByVal armourIndex As Byte, ByVal objectIndex As Integer)
  10599.  
  10600.         '***************************************************
  10601.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10602.        'Last Modification: 05/17/06
  10603.        'Writes the "ChaosArmour" message to the outgoing data buffer
  10604.        '***************************************************
  10605.        With outgoingData
  10606.                 Call .WriteByte(ClientPacketID.GMCommands)
  10607.                 Call .WriteByte(eGMCommands.ChaosArmour)
  10608.        
  10609.                 Call .WriteByte(armourIndex)
  10610.        
  10611.                 Call .WriteInteger(objectIndex)
  10612.  
  10613.         End With
  10614.  
  10615. End Sub
  10616.  
  10617. ''
  10618. ' Writes the "NavigateToggle" message to the outgoing data buffer.
  10619. '
  10620. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10621.  
  10622. Public Sub WriteNavigateToggle()
  10623.         '***************************************************
  10624.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10625.        'Last Modification: 05/17/06
  10626.        'Writes the "NavigateToggle" message to the outgoing data buffer
  10627.        '***************************************************
  10628.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10629.         Call outgoingData.WriteByte(eGMCommands.NavigateToggle)
  10630.  
  10631. End Sub
  10632.  
  10633. ''
  10634. ' Writes the "ServerOpenToUsersToggle" message to the outgoing data buffer.
  10635. '
  10636. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10637.  
  10638. Public Sub WriteServerOpenToUsersToggle()
  10639.         '***************************************************
  10640.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10641.        'Last Modification: 05/17/06
  10642.        'Writes the "ServerOpenToUsersToggle" message to the outgoing data buffer
  10643.        '***************************************************
  10644.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10645.         Call outgoingData.WriteByte(eGMCommands.ServerOpenToUsersToggle)
  10646.  
  10647. End Sub
  10648.  
  10649. ''
  10650. ' Writes the "TurnOffServer" message to the outgoing data buffer.
  10651. '
  10652. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10653.  
  10654. Public Sub WriteTurnOffServer()
  10655.         '***************************************************
  10656.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10657.        'Last Modification: 05/17/06
  10658.        'Writes the "TurnOffServer" message to the outgoing data buffer
  10659.        '***************************************************
  10660.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10661.         Call outgoingData.WriteByte(eGMCommands.TurnOffServer)
  10662.  
  10663. End Sub
  10664.  
  10665. ''
  10666. ' Writes the "TurnCriminal" message to the outgoing data buffer.
  10667. '
  10668. ' @param    username The name of the user to turn into criminal.
  10669. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10670.  
  10671. Public Sub WriteTurnCriminal(ByVal UserName As String)
  10672.  
  10673.         '***************************************************
  10674.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10675.        'Last Modification: 05/17/06
  10676.        'Writes the "TurnCriminal" message to the outgoing data buffer
  10677.        '***************************************************
  10678.        With outgoingData
  10679.                 Call .WriteByte(ClientPacketID.GMCommands)
  10680.                 Call .WriteByte(eGMCommands.TurnCriminal)
  10681.        
  10682.                 Call .WriteASCIIString(UserName)
  10683.  
  10684.         End With
  10685.  
  10686. End Sub
  10687.  
  10688. ''
  10689. ' Writes the "ResetFactions" message to the outgoing data buffer.
  10690. '
  10691. ' @param    username The name of the user who will be removed from any faction.
  10692. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10693.  
  10694. Public Sub WriteResetFactions(ByVal UserName As String)
  10695.  
  10696.         '***************************************************
  10697.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10698.        'Last Modification: 05/17/06
  10699.        'Writes the "ResetFactions" message to the outgoing data buffer
  10700.        '***************************************************
  10701.        With outgoingData
  10702.                 Call .WriteByte(ClientPacketID.GMCommands)
  10703.                 Call .WriteByte(eGMCommands.ResetFactions)
  10704.        
  10705.                 Call .WriteASCIIString(UserName)
  10706.  
  10707.         End With
  10708.  
  10709. End Sub
  10710.  
  10711. ''
  10712. ' Writes the "RemoveCharFromGuild" message to the outgoing data buffer.
  10713. '
  10714. ' @param    username The name of the user who will be removed from any guild.
  10715. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10716.  
  10717. Public Sub WriteRemoveCharFromGuild(ByVal UserName As String)
  10718.  
  10719.         '***************************************************
  10720.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10721.        'Last Modification: 05/17/06
  10722.        'Writes the "RemoveCharFromGuild" message to the outgoing data buffer
  10723.        '***************************************************
  10724.        With outgoingData
  10725.                 Call .WriteByte(ClientPacketID.GMCommands)
  10726.                 Call .WriteByte(eGMCommands.RemoveCharFromGuild)
  10727.        
  10728.                 Call .WriteASCIIString(UserName)
  10729.  
  10730.         End With
  10731.  
  10732. End Sub
  10733.  
  10734. ''
  10735. ' Writes the "RequestCharMail" message to the outgoing data buffer.
  10736. '
  10737. ' @param    username The name of the user whose mail is requested.
  10738. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10739.  
  10740. Public Sub WriteRequestCharMail(ByVal UserName As String)
  10741.  
  10742.         '***************************************************
  10743.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10744.        'Last Modification: 05/17/06
  10745.        'Writes the "RequestCharMail" message to the outgoing data buffer
  10746.        '***************************************************
  10747.        With outgoingData
  10748.                 Call .WriteByte(ClientPacketID.GMCommands)
  10749.                 Call .WriteByte(eGMCommands.RequestCharMail)
  10750.        
  10751.                 Call .WriteASCIIString(UserName)
  10752.  
  10753.         End With
  10754.  
  10755. End Sub
  10756.  
  10757. ''
  10758. ' Writes the "AlterPassword" message to the outgoing data buffer.
  10759. '
  10760. ' @param    username The name of the user whose mail is requested.
  10761. ' @param    copyFrom The name of the user from which to copy the password.
  10762. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10763.  
  10764. Public Sub WriteAlterPassword(ByVal UserName As String, ByVal CopyFrom As String)
  10765.  
  10766.         '***************************************************
  10767.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10768.        'Last Modification: 05/17/06
  10769.        'Writes the "AlterPassword" message to the outgoing data buffer
  10770.        '***************************************************
  10771.        With outgoingData
  10772.                 Call .WriteByte(ClientPacketID.GMCommands)
  10773.                 Call .WriteByte(eGMCommands.AlterPassword)
  10774.        
  10775.                 Call .WriteASCIIString(UserName)
  10776.                 Call .WriteASCIIString(CopyFrom)
  10777.  
  10778.         End With
  10779.  
  10780. End Sub
  10781.  
  10782. ''
  10783. ' Writes the "AlterMail" message to the outgoing data buffer.
  10784. '
  10785. ' @param    username The name of the user whose mail is requested.
  10786. ' @param    newMail The new email of the player.
  10787. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10788.  
  10789. Public Sub WriteAlterMail(ByVal UserName As String, ByVal newMail As String)
  10790.  
  10791.         '***************************************************
  10792.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10793.        'Last Modification: 05/17/06
  10794.        'Writes the "AlterMail" message to the outgoing data buffer
  10795.        '***************************************************
  10796.        With outgoingData
  10797.                 Call .WriteByte(ClientPacketID.GMCommands)
  10798.                 Call .WriteByte(eGMCommands.AlterMail)
  10799.        
  10800.                 Call .WriteASCIIString(UserName)
  10801.                 Call .WriteASCIIString(newMail)
  10802.  
  10803.         End With
  10804.  
  10805. End Sub
  10806.  
  10807. ''
  10808. ' Writes the "AlterName" message to the outgoing data buffer.
  10809. '
  10810. ' @param    username The name of the user whose mail is requested.
  10811. ' @param    newName The new user name.
  10812. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10813.  
  10814. Public Sub WriteAlterName(ByVal UserName As String, ByVal newName As String)
  10815.  
  10816.         '***************************************************
  10817.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10818.        'Last Modification: 05/17/06
  10819.        'Writes the "AlterName" message to the outgoing data buffer
  10820.        '***************************************************
  10821.        With outgoingData
  10822.                 Call .WriteByte(ClientPacketID.GMCommands)
  10823.                 Call .WriteByte(eGMCommands.AlterName)
  10824.        
  10825.                 Call .WriteASCIIString(UserName)
  10826.                 Call .WriteASCIIString(newName)
  10827.  
  10828.         End With
  10829.  
  10830. End Sub
  10831.  
  10832. ''
  10833. ' Writes the "ToggleCentinelActivated" message to the outgoing data buffer.
  10834. '
  10835. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10836.  
  10837. Public Sub WriteToggleCentinelActivated()
  10838.         '***************************************************
  10839.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10840.        'Last Modification: 05/17/06
  10841.        'Writes the "ToggleCentinelActivated" message to the outgoing data buffer
  10842.        '***************************************************
  10843.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10844.         Call outgoingData.WriteByte(eGMCommands.ToggleCentinelActivated)
  10845.  
  10846. End Sub
  10847.  
  10848. ''
  10849. ' Writes the "DoBackup" message to the outgoing data buffer.
  10850. '
  10851. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10852.  
  10853. Public Sub WriteDoBackup()
  10854.         '***************************************************
  10855.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10856.        'Last Modification: 05/17/06
  10857.        'Writes the "DoBackup" message to the outgoing data buffer
  10858.        '***************************************************
  10859.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10860.         Call outgoingData.WriteByte(eGMCommands.DoBackUp)
  10861.  
  10862. End Sub
  10863.  
  10864. ''
  10865. ' Writes the "ShowGuildMessages" message to the outgoing data buffer.
  10866. '
  10867. ' @param    guild The guild to listen to.
  10868. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10869.  
  10870. Public Sub WriteShowGuildMessages(ByVal guild As String)
  10871.  
  10872.         '***************************************************
  10873.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10874.        'Last Modification: 05/17/06
  10875.        'Writes the "ShowGuildMessages" message to the outgoing data buffer
  10876.        '***************************************************
  10877.        With outgoingData
  10878.                 Call .WriteByte(ClientPacketID.GMCommands)
  10879.                 Call .WriteByte(eGMCommands.ShowGuildMessages)
  10880.        
  10881.                 Call .WriteASCIIString(guild)
  10882.  
  10883.         End With
  10884.  
  10885. End Sub
  10886.  
  10887. ''
  10888. ' Writes the "SaveMap" message to the outgoing data buffer.
  10889. '
  10890. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10891.  
  10892. Public Sub WriteSaveMap()
  10893.         '***************************************************
  10894.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10895.        'Last Modification: 05/17/06
  10896.        'Writes the "SaveMap" message to the outgoing data buffer
  10897.        '***************************************************
  10898.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  10899.         Call outgoingData.WriteByte(eGMCommands.SaveMap)
  10900.  
  10901. End Sub
  10902.  
  10903. ''
  10904. ' Writes the "ChangeMapInfoPK" message to the outgoing data buffer.
  10905. '
  10906. ' @param    isPK True if the map is PK, False otherwise.
  10907. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10908.  
  10909. Public Sub WriteChangeMapInfoPK(ByVal isPK As Boolean)
  10910.  
  10911.         '***************************************************
  10912.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10913.        'Last Modification: 05/17/06
  10914.        'Writes the "ChangeMapInfoPK" message to the outgoing data buffer
  10915.        '***************************************************
  10916.        With outgoingData
  10917.                 Call .WriteByte(ClientPacketID.GMCommands)
  10918.                 Call .WriteByte(eGMCommands.ChangeMapInfoPK)
  10919.        
  10920.                 Call .WriteBoolean(isPK)
  10921.  
  10922.         End With
  10923.  
  10924. End Sub
  10925.  
  10926. ''
  10927. ' Writes the "ChangeMapInfoNoOcultar" message to the outgoing data buffer.
  10928. '
  10929. ' @param    PermitirOcultar True if the map permits to hide, False otherwise.
  10930. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10931.  
  10932. Public Sub WriteChangeMapInfoNoOcultar(ByVal PermitirOcultar As Boolean)
  10933.  
  10934.         '***************************************************
  10935.        'Author: ZaMa
  10936.        'Last Modification: 19/09/2010
  10937.        'Writes the "ChangeMapInfoNoOcultar" message to the outgoing data buffer
  10938.        '***************************************************
  10939.        With outgoingData
  10940.                 Call .WriteByte(ClientPacketID.GMCommands)
  10941.                 Call .WriteByte(eGMCommands.ChangeMapInfoNoOcultar)
  10942.        
  10943.                 Call .WriteBoolean(PermitirOcultar)
  10944.  
  10945.         End With
  10946.  
  10947. End Sub
  10948.  
  10949. ''
  10950. ' Writes the "ChangeMapInfoNoInvocar" message to the outgoing data buffer.
  10951. '
  10952. ' @param    PermitirInvocar True if the map permits to invoke, False otherwise.
  10953. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10954.  
  10955. Public Sub WriteChangeMapInfoNoInvocar(ByVal PermitirInvocar As Boolean)
  10956.  
  10957.         '***************************************************
  10958.        'Author: ZaMa
  10959.        'Last Modification: 18/09/2010
  10960.        'Writes the "ChangeMapInfoNoInvocar" message to the outgoing data buffer
  10961.        '***************************************************
  10962.        With outgoingData
  10963.                 Call .WriteByte(ClientPacketID.GMCommands)
  10964.                 Call .WriteByte(eGMCommands.ChangeMapInfoNoInvocar)
  10965.        
  10966.                 Call .WriteBoolean(PermitirInvocar)
  10967.  
  10968.         End With
  10969.  
  10970. End Sub
  10971.  
  10972. ''
  10973. ' Writes the "ChangeMapInfoBackup" message to the outgoing data buffer.
  10974. '
  10975. ' @param    backup True if the map is to be backuped, False otherwise.
  10976. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  10977.  
  10978. Public Sub WriteChangeMapInfoBackup(ByVal backup As Boolean)
  10979.  
  10980.         '***************************************************
  10981.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  10982.        'Last Modification: 05/17/06
  10983.        'Writes the "ChangeMapInfoBackup" message to the outgoing data buffer
  10984.        '***************************************************
  10985.        With outgoingData
  10986.                 Call .WriteByte(ClientPacketID.GMCommands)
  10987.                 Call .WriteByte(eGMCommands.ChangeMapInfoBackup)
  10988.        
  10989.                 Call .WriteBoolean(backup)
  10990.  
  10991.         End With
  10992.  
  10993. End Sub
  10994.  
  10995. ''
  10996. ' Writes the "ChangeMapInfoRestricted" message to the outgoing data buffer.
  10997. '
  10998. ' @param    restrict NEWBIES (only newbies), NO (everyone), ARMADA (just Armadas), CAOS (just caos) or FACCION (Armadas & caos only)
  10999. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11000.  
  11001. Public Sub WriteChangeMapInfoRestricted(ByVal restrict As String)
  11002.  
  11003.         '***************************************************
  11004.        'Author: Pablo (ToxicWaste)
  11005.        'Last Modification: 26/01/2007
  11006.        'Writes the "ChangeMapInfoRestricted" message to the outgoing data buffer
  11007.        '***************************************************
  11008.        With outgoingData
  11009.                 Call .WriteByte(ClientPacketID.GMCommands)
  11010.                 Call .WriteByte(eGMCommands.ChangeMapInfoRestricted)
  11011.        
  11012.                 Call .WriteASCIIString(restrict)
  11013.  
  11014.         End With
  11015.  
  11016. End Sub
  11017.  
  11018. ''
  11019. ' Writes the "ChangeMapInfoNoMagic" message to the outgoing data buffer.
  11020. '
  11021. ' @param    nomagic TRUE if no magic is to be allowed in the map.
  11022. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11023.  
  11024. Public Sub WriteChangeMapInfoNoMagic(ByVal nomagic As Boolean)
  11025.  
  11026.         '***************************************************
  11027.        'Author: Pablo (ToxicWaste)
  11028.        'Last Modification: 26/01/2007
  11029.        'Writes the "ChangeMapInfoNoMagic" message to the outgoing data buffer
  11030.        '***************************************************
  11031.        With outgoingData
  11032.                 Call .WriteByte(ClientPacketID.GMCommands)
  11033.                 Call .WriteByte(eGMCommands.ChangeMapInfoNoMagic)
  11034.        
  11035.                 Call .WriteBoolean(nomagic)
  11036.  
  11037.         End With
  11038.  
  11039. End Sub
  11040.  
  11041. ''
  11042. ' Writes the "ChangeMapInfoNoInvi" message to the outgoing data buffer.
  11043. '
  11044. ' @param    noinvi TRUE if invisibility is not to be allowed in the map.
  11045. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11046.  
  11047. Public Sub WriteChangeMapInfoNoInvi(ByVal noinvi As Boolean)
  11048.  
  11049.         '***************************************************
  11050.        'Author: Pablo (ToxicWaste)
  11051.        'Last Modification: 26/01/2007
  11052.        'Writes the "ChangeMapInfoNoInvi" message to the outgoing data buffer
  11053.        '***************************************************
  11054.        With outgoingData
  11055.                 Call .WriteByte(ClientPacketID.GMCommands)
  11056.                 Call .WriteByte(eGMCommands.ChangeMapInfoNoInvi)
  11057.        
  11058.                 Call .WriteBoolean(noinvi)
  11059.  
  11060.         End With
  11061.  
  11062. End Sub
  11063.                            
  11064. ''
  11065. ' Writes the "ChangeMapInfoNoResu" message to the outgoing data buffer.
  11066. '
  11067. ' @param    noresu TRUE if resurection is not to be allowed in the map.
  11068. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11069.  
  11070. Public Sub WriteChangeMapInfoNoResu(ByVal noresu As Boolean)
  11071.  
  11072.         '***************************************************
  11073.        'Author: Pablo (ToxicWaste)
  11074.        'Last Modification: 26/01/2007
  11075.        'Writes the "ChangeMapInfoNoResu" message to the outgoing data buffer
  11076.        '***************************************************
  11077.        With outgoingData
  11078.                 Call .WriteByte(ClientPacketID.GMCommands)
  11079.                 Call .WriteByte(eGMCommands.ChangeMapInfoNoResu)
  11080.        
  11081.                 Call .WriteBoolean(noresu)
  11082.  
  11083.         End With
  11084.  
  11085. End Sub
  11086.                        
  11087. ''
  11088. ' Writes the "ChangeMapInfoLand" message to the outgoing data buffer.
  11089. '
  11090. ' @param    land options: "BOSQUE", "NIEVE", "DESIERTO", "CIUDAD", "CAMPO", "DUNGEON".
  11091. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11092.  
  11093. Public Sub WriteChangeMapInfoLand(ByVal land As String)
  11094.  
  11095.         '***************************************************
  11096.        'Author: Pablo (ToxicWaste)
  11097.        'Last Modification: 26/01/2007
  11098.        'Writes the "ChangeMapInfoLand" message to the outgoing data buffer
  11099.        '***************************************************
  11100.        With outgoingData
  11101.                 Call .WriteByte(ClientPacketID.GMCommands)
  11102.                 Call .WriteByte(eGMCommands.ChangeMapInfoLand)
  11103.        
  11104.                 Call .WriteASCIIString(land)
  11105.  
  11106.         End With
  11107.  
  11108. End Sub
  11109.                        
  11110. ''
  11111. ' Writes the "ChangeMapInfoZone" message to the outgoing data buffer.
  11112. '
  11113. ' @param    zone options: "BOSQUE", "NIEVE", "DESIERTO", "CIUDAD", "CAMPO", "DUNGEON".
  11114. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11115.  
  11116. Public Sub WriteChangeMapInfoZone(ByVal zone As String)
  11117.  
  11118.         '***************************************************
  11119.        'Author: Pablo (ToxicWaste)
  11120.        'Last Modification: 26/01/2007
  11121.        'Writes the "ChangeMapInfoZone" message to the outgoing data buffer
  11122.        '***************************************************
  11123.        With outgoingData
  11124.                 Call .WriteByte(ClientPacketID.GMCommands)
  11125.                 Call .WriteByte(eGMCommands.ChangeMapInfoZone)
  11126.        
  11127.                 Call .WriteASCIIString(zone)
  11128.  
  11129.         End With
  11130.  
  11131. End Sub
  11132.  
  11133. ''
  11134. ' Writes the "ChangeMapInfoStealNpc" message to the outgoing data buffer.
  11135. '
  11136. ' @param    forbid TRUE if stealNpc forbiden.
  11137. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11138.  
  11139. Public Sub WriteChangeMapInfoStealNpc(ByVal forbid As Boolean)
  11140.  
  11141.         '***************************************************
  11142.        'Author: ZaMa
  11143.        'Last Modification: 25/07/2010
  11144.        'Writes the "ChangeMapInfoStealNpc" message to the outgoing data buffer
  11145.        '***************************************************
  11146.        With outgoingData
  11147.                 Call .WriteByte(ClientPacketID.GMCommands)
  11148.                 Call .WriteByte(eGMCommands.ChangeMapInfoStealNpc)
  11149.        
  11150.                 Call .WriteBoolean(forbid)
  11151.  
  11152.         End With
  11153.  
  11154. End Sub
  11155.  
  11156. ''
  11157. ' Writes the "SaveChars" message to the outgoing data buffer.
  11158. '
  11159. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11160.  
  11161. Public Sub WriteSaveChars()
  11162.         '***************************************************
  11163.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11164.        'Last Modification: 05/17/06
  11165.        'Writes the "SaveChars" message to the outgoing data buffer
  11166.        '***************************************************
  11167.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11168.         Call outgoingData.WriteByte(eGMCommands.SaveChars)
  11169.  
  11170. End Sub
  11171.  
  11172. ''
  11173. ' Writes the "CleanSOS" message to the outgoing data buffer.
  11174. '
  11175. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11176.  
  11177. Public Sub WriteCleanSOS()
  11178.         '***************************************************
  11179.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11180.        'Last Modification: 05/17/06
  11181.        'Writes the "CleanSOS" message to the outgoing data buffer
  11182.        '***************************************************
  11183.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11184.         Call outgoingData.WriteByte(eGMCommands.CleanSOS)
  11185.  
  11186. End Sub
  11187.  
  11188. ''
  11189. ' Writes the "ShowServerForm" message to the outgoing data buffer.
  11190. '
  11191. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11192.  
  11193. Public Sub WriteShowServerForm()
  11194.         '***************************************************
  11195.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11196.        'Last Modification: 05/17/06
  11197.        'Writes the "ShowServerForm" message to the outgoing data buffer
  11198.        '***************************************************
  11199.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11200.         Call outgoingData.WriteByte(eGMCommands.ShowServerForm)
  11201.  
  11202. End Sub
  11203.  
  11204. ''
  11205. ' Writes the "ShowDenouncesList" message to the outgoing data buffer.
  11206. '
  11207. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11208.  
  11209. Public Sub WriteShowDenouncesList()
  11210.         '***************************************************
  11211.        'Author: ZaMa
  11212.        'Last Modification: 14/11/2010
  11213.        'Writes the "ShowDenouncesList" message to the outgoing data buffer
  11214.        '***************************************************
  11215.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11216.         Call outgoingData.WriteByte(eGMCommands.ShowDenouncesList)
  11217.  
  11218. End Sub
  11219.  
  11220. ''
  11221. ' Writes the "EnableDenounces" message to the outgoing data buffer.
  11222. '
  11223. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11224.  
  11225. Public Sub WriteEnableDenounces()
  11226.         '***************************************************
  11227.        'Author: ZaMa
  11228.        'Last Modification: 14/11/2010
  11229.        'Writes the "EnableDenounces" message to the outgoing data buffer
  11230.        '***************************************************
  11231.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11232.         Call outgoingData.WriteByte(eGMCommands.EnableDenounces)
  11233.  
  11234. End Sub
  11235.  
  11236. ''
  11237. ' Writes the "Night" message to the outgoing data buffer.
  11238. '
  11239. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11240.  
  11241. Public Sub WriteNight()
  11242.         '***************************************************
  11243.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11244.        'Last Modification: 05/17/06
  11245.        'Writes the "Night" message to the outgoing data buffer
  11246.        '***************************************************
  11247.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11248.         Call outgoingData.WriteByte(eGMCommands.night)
  11249.  
  11250. End Sub
  11251.  
  11252. ''
  11253. ' Writes the "KickAllChars" message to the outgoing data buffer.
  11254. '
  11255. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11256.  
  11257. Public Sub WriteKickAllChars()
  11258.         '***************************************************
  11259.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11260.        'Last Modification: 05/17/06
  11261.        'Writes the "KickAllChars" message to the outgoing data buffer
  11262.        '***************************************************
  11263.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11264.         Call outgoingData.WriteByte(eGMCommands.KickAllChars)
  11265.  
  11266. End Sub
  11267.  
  11268. ''
  11269. ' Writes the "ReloadNPCs" message to the outgoing data buffer.
  11270. '
  11271. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11272.  
  11273. Public Sub WriteReloadNPCs()
  11274.         '***************************************************
  11275.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11276.        'Last Modification: 05/17/06
  11277.        'Writes the "ReloadNPCs" message to the outgoing data buffer
  11278.        '***************************************************
  11279.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11280.         Call outgoingData.WriteByte(eGMCommands.ReloadNPCs)
  11281.  
  11282. End Sub
  11283.  
  11284. ''
  11285. ' Writes the "ReloadServerIni" message to the outgoing data buffer.
  11286. '
  11287. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11288.  
  11289. Public Sub WriteReloadServerIni()
  11290.         '***************************************************
  11291.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11292.        'Last Modification: 05/17/06
  11293.        'Writes the "ReloadServerIni" message to the outgoing data buffer
  11294.        '***************************************************
  11295.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11296.         Call outgoingData.WriteByte(eGMCommands.ReloadServerIni)
  11297.  
  11298. End Sub
  11299.  
  11300. ''
  11301. ' Writes the "ReloadSpells" message to the outgoing data buffer.
  11302. '
  11303. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11304.  
  11305. Public Sub WriteReloadSpells()
  11306.         '***************************************************
  11307.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11308.        'Last Modification: 05/17/06
  11309.        'Writes the "ReloadSpells" message to the outgoing data buffer
  11310.        '***************************************************
  11311.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11312.         Call outgoingData.WriteByte(eGMCommands.ReloadSpells)
  11313.  
  11314. End Sub
  11315.  
  11316. ''
  11317. ' Writes the "ReloadObjects" message to the outgoing data buffer.
  11318. '
  11319. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11320.  
  11321. Public Sub WriteReloadObjects()
  11322.         '***************************************************
  11323.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11324.        'Last Modification: 05/17/06
  11325.        'Writes the "ReloadObjects" message to the outgoing data buffer
  11326.        '***************************************************
  11327.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11328.         Call outgoingData.WriteByte(eGMCommands.ReloadObjects)
  11329.  
  11330. End Sub
  11331.  
  11332. ''
  11333. ' Writes the "Restart" message to the outgoing data buffer.
  11334. '
  11335. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11336.  
  11337. Public Sub WriteRestart()
  11338.         '***************************************************
  11339.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11340.        'Last Modification: 05/17/06
  11341.        'Writes the "Restart" message to the outgoing data buffer
  11342.        '***************************************************
  11343.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11344.         Call outgoingData.WriteByte(eGMCommands.Restart)
  11345.  
  11346. End Sub
  11347.  
  11348. ''
  11349. ' Writes the "ResetAutoUpdate" message to the outgoing data buffer.
  11350. '
  11351. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11352.  
  11353. Public Sub WriteResetAutoUpdate()
  11354.         '***************************************************
  11355.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11356.        'Last Modification: 05/17/06
  11357.        'Writes the "ResetAutoUpdate" message to the outgoing data buffer
  11358.        '***************************************************
  11359.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11360.         Call outgoingData.WriteByte(eGMCommands.ResetAutoUpdate)
  11361.  
  11362. End Sub
  11363.  
  11364. ''
  11365. ' Writes the "ChatColor" message to the outgoing data buffer.
  11366. '
  11367. ' @param    r The red component of the new chat color.
  11368. ' @param    g The green component of the new chat color.
  11369. ' @param    b The blue component of the new chat color.
  11370. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11371.  
  11372. Public Sub WriteChatColor(ByVal r As Byte, ByVal g As Byte, ByVal B As Byte)
  11373.  
  11374.         '***************************************************
  11375.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11376.        'Last Modification: 05/17/06
  11377.        'Writes the "ChatColor" message to the outgoing data buffer
  11378.        '***************************************************
  11379.        With outgoingData
  11380.                 Call .WriteByte(ClientPacketID.GMCommands)
  11381.                 Call .WriteByte(eGMCommands.ChatColor)
  11382.        
  11383.                 Call .WriteByte(r)
  11384.                 Call .WriteByte(g)
  11385.                 Call .WriteByte(B)
  11386.  
  11387.         End With
  11388.  
  11389. End Sub
  11390.  
  11391. ''
  11392. ' Writes the "Ignored" message to the outgoing data buffer.
  11393. '
  11394. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11395.  
  11396. Public Sub WriteIgnored()
  11397.         '***************************************************
  11398.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11399.        'Last Modification: 05/17/06
  11400.        'Writes the "Ignored" message to the outgoing data buffer
  11401.        '***************************************************
  11402.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11403.         Call outgoingData.WriteByte(eGMCommands.Ignored)
  11404.  
  11405. End Sub
  11406.  
  11407. ''
  11408. ' Writes the "CheckSlot" message to the outgoing data buffer.
  11409. '
  11410. ' @param    UserName    The name of the char whose slot will be checked.
  11411. ' @param    slot        The slot to be checked.
  11412. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11413.  
  11414. Public Sub WriteCheckSlot(ByVal UserName As String, ByVal Slot As Byte)
  11415.  
  11416.         '***************************************************
  11417.        'Author: Pablo (ToxicWaste)
  11418.        'Last Modification: 26/01/2007
  11419.        'Writes the "CheckSlot" message to the outgoing data buffer
  11420.        '***************************************************
  11421.        With outgoingData
  11422.                 Call .WriteByte(ClientPacketID.GMCommands)
  11423.                 Call .WriteByte(eGMCommands.CheckSlot)
  11424.                 Call .WriteASCIIString(UserName)
  11425.                 Call .WriteByte(Slot)
  11426.  
  11427.         End With
  11428.  
  11429. End Sub
  11430.  
  11431. ''
  11432. ' Writes the "Ping" message to the outgoing data buffer.
  11433. '
  11434. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11435.  
  11436. Public Sub WritePing()
  11437.  
  11438.         '***************************************************
  11439.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11440.        'Last Modification: 26/01/2007
  11441.        'Writes the "Ping" message to the outgoing data buffer
  11442.        '***************************************************
  11443.        'Prevent the timer from being cut
  11444.        If pingTime <> 0 Then Exit Sub
  11445.    
  11446.         Call outgoingData.WriteByte(ClientPacketID.Ping)
  11447.    
  11448.         ' Avoid computing errors due to frame rate
  11449.        Call FlushBuffer
  11450.         DoEvents
  11451.    
  11452.         pingTime = GetTickCount
  11453.  
  11454. End Sub
  11455.  
  11456. ''
  11457. ' Writes the "ShareNpc" message to the outgoing data buffer.
  11458. '
  11459. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11460.  
  11461. Public Sub WriteShareNpc()
  11462.         '***************************************************
  11463.        'Author: ZaMa
  11464.        'Last Modification: 15/04/2010
  11465.        'Writes the "ShareNpc" message to the outgoing data buffer
  11466.        '***************************************************
  11467.        Call outgoingData.WriteByte(ClientPacketID.ShareNpc)
  11468.  
  11469. End Sub
  11470.  
  11471. ''
  11472. ' Writes the "StopSharingNpc" message to the outgoing data buffer.
  11473. '
  11474. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11475.  
  11476. Public Sub WriteStopSharingNpc()
  11477.         '***************************************************
  11478.        'Author: ZaMa
  11479.        'Last Modification: 15/04/2010
  11480.        'Writes the "StopSharingNpc" message to the outgoing data buffer
  11481.        '***************************************************
  11482.        Call outgoingData.WriteByte(ClientPacketID.StopSharingNpc)
  11483.  
  11484. End Sub
  11485.  
  11486. ''
  11487. ' Writes the "SetIniVar" message to the outgoing data buffer.
  11488. '
  11489. ' @param    sLlave the name of the key which contains the value to edit
  11490. ' @param    sClave the name of the value to edit
  11491. ' @param    sValor the new value to set to sClave
  11492. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11493.  
  11494. Public Sub WriteSetIniVar(ByRef sLlave As String, _
  11495.                           ByRef sClave As String, _
  11496.                           ByRef sValor As String)
  11497.  
  11498.         '***************************************************
  11499.        'Author: Brian Chaia (BrianPr)
  11500.        'Last Modification: 21/06/2009
  11501.        'Writes the "SetIniVar" message to the outgoing data buffer
  11502.        '***************************************************
  11503.        With outgoingData
  11504.                 Call .WriteByte(ClientPacketID.GMCommands)
  11505.                 Call .WriteByte(eGMCommands.SetIniVar)
  11506.        
  11507.                 Call .WriteASCIIString(sLlave)
  11508.                 Call .WriteASCIIString(sClave)
  11509.                 Call .WriteASCIIString(sValor)
  11510.  
  11511.         End With
  11512.  
  11513. End Sub
  11514.  
  11515. ''
  11516. ' Writes the "CreatePretorianClan" message to the outgoing data buffer.
  11517. '
  11518. ' @param    Map         The map in which create the pretorian clan.
  11519. ' @param    X           The x pos where the king is settled.
  11520. ' @param    Y           The y pos where the king is settled.
  11521. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11522.  
  11523. Public Sub WriteCreatePretorianClan(ByVal Map As Integer, _
  11524.                                     ByVal x As Byte, _
  11525.                                     ByVal y As Byte)
  11526.  
  11527.         '***************************************************
  11528.        'Author: ZaMa
  11529.        'Last Modification: 29/10/2010
  11530.        'Writes the "CreatePretorianClan" message to the outgoing data buffer
  11531.        '***************************************************
  11532.        With outgoingData
  11533.                 Call .WriteByte(ClientPacketID.GMCommands)
  11534.                 Call .WriteByte(eGMCommands.CreatePretorianClan)
  11535.                 Call .WriteInteger(Map)
  11536.                 Call .WriteByte(x)
  11537.                 Call .WriteByte(y)
  11538.  
  11539.         End With
  11540.  
  11541. End Sub
  11542.  
  11543. ''
  11544. ' Writes the "DeletePretorianClan" message to the outgoing data buffer.
  11545. '
  11546. ' @param    Map         The map which contains the pretorian clan to be removed.
  11547. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11548.  
  11549. Public Sub WriteDeletePretorianClan(ByVal Map As Integer)
  11550.  
  11551.         '***************************************************
  11552.        'Author: ZaMa
  11553.        'Last Modification: 29/10/2010
  11554.        'Writes the "DeletePretorianClan" message to the outgoing data buffer
  11555.        '***************************************************
  11556.        With outgoingData
  11557.                 Call .WriteByte(ClientPacketID.GMCommands)
  11558.                 Call .WriteByte(eGMCommands.RemovePretorianClan)
  11559.                 Call .WriteInteger(Map)
  11560.  
  11561.         End With
  11562.  
  11563. End Sub
  11564.  
  11565. ''
  11566. ' Flushes the outgoing data buffer of the user.
  11567. '
  11568. ' @param    UserIndex User whose outgoing data buffer will be flushed.
  11569.  
  11570. Public Sub FlushBuffer()
  11571.  
  11572.         '***************************************************
  11573.        'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11574.        'Last Modification: 05/17/06
  11575.        'Sends all data existing in the buffer
  11576.        '***************************************************
  11577.        Dim sndData As String
  11578.    
  11579.         With outgoingData
  11580.  
  11581.                 If .Length = 0 Then _
  11582.                    Exit Sub
  11583.        
  11584.                 sndData = .ReadASCIIStringFixed(.Length)
  11585.        
  11586.                 Call SendData(sndData)
  11587.  
  11588.         End With
  11589.  
  11590. End Sub
  11591.  
  11592. ''
  11593. ' Sends the data using the socket controls in the MainForm.
  11594. '
  11595. ' @param    sdData  The data to be sent to the server.
  11596.  
  11597. Private Sub SendData(ByRef sdData As String)
  11598.    
  11599.         'No enviamos nada si no estamos conectados
  11600.    
  11601.         If Not frmMain.Socket1.IsWritable Then
  11602.                 'Put data back in the bytequeue
  11603.                Call outgoingData.WriteASCIIStringFixed(sdData)
  11604.        
  11605.                 Exit Sub
  11606.  
  11607.         End If
  11608.    
  11609.         If Not frmMain.Socket1.Connected Then Exit Sub
  11610.    
  11611.         'Send data!
  11612.  
  11613.         Call frmMain.Socket1.Write(sdData, Len(sdData))
  11614.  
  11615. End Sub
  11616.  
  11617. ''
  11618. ' Writes the "MapMessage" message to the outgoing data buffer.
  11619. '
  11620. ' @param    Dialog The new dialog of the NPC.
  11621. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11622.  
  11623. Public Sub WriteSetDialog(ByVal dialog As String)
  11624.  
  11625.         '***************************************************
  11626.        'Author: Amraphen
  11627.        'Last Modification: 18/11/2010
  11628.        'Writes the "SetDialog" message to the outgoing data buffer
  11629.        '***************************************************
  11630.        With outgoingData
  11631.                 Call .WriteByte(ClientPacketID.GMCommands)
  11632.                 Call .WriteByte(eGMCommands.SetDialog)
  11633.        
  11634.                 Call .WriteASCIIString(dialog)
  11635.  
  11636.         End With
  11637.  
  11638. End Sub
  11639.  
  11640. ''
  11641. ' Writes the "Impersonate" message to the outgoing data buffer.
  11642. '
  11643. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11644.  
  11645. Public Sub WriteImpersonate()
  11646.         '***************************************************
  11647.        'Author: ZaMa
  11648.        'Last Modification: 20/11/2010
  11649.        'Writes the "Impersonate" message to the outgoing data buffer
  11650.        '***************************************************
  11651.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11652.         Call outgoingData.WriteByte(eGMCommands.Impersonate)
  11653.  
  11654. End Sub
  11655.  
  11656. ''
  11657. ' Writes the "Imitate" message to the outgoing data buffer.
  11658. '
  11659. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11660.  
  11661. Public Sub WriteImitate()
  11662.         '***************************************************
  11663.        'Author: ZaMa
  11664.        'Last Modification: 20/11/2010
  11665.        'Writes the "Imitate" message to the outgoing data buffer
  11666.        '***************************************************
  11667.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11668.         Call outgoingData.WriteByte(eGMCommands.Imitate)
  11669.  
  11670. End Sub
  11671.  
  11672. ''
  11673. ' Writes the "RecordAddObs" message to the outgoing data buffer.
  11674. '
  11675. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11676.  
  11677. Public Sub WriteRecordAddObs(ByVal RecordIndex As Byte, ByVal Observation As String)
  11678.  
  11679.         '***************************************************
  11680.        'Author: Amraphen
  11681.        'Last Modification: 29/11/2010
  11682.        'Writes the "RecordAddObs" message to the outgoing data buffer
  11683.        '***************************************************
  11684.        With outgoingData
  11685.                 Call .WriteByte(ClientPacketID.GMCommands)
  11686.                 Call .WriteByte(eGMCommands.RecordAddObs)
  11687.        
  11688.                 Call .WriteByte(RecordIndex)
  11689.                 Call .WriteASCIIString(Observation)
  11690.  
  11691.         End With
  11692.  
  11693. End Sub
  11694.  
  11695. ''
  11696. ' Writes the "RecordAdd" message to the outgoing data buffer.
  11697. '
  11698. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11699.  
  11700. Public Sub WriteRecordAdd(ByVal Nickname As String, ByVal reason As String)
  11701.  
  11702.         '***************************************************
  11703.        'Author: Amraphen
  11704.        'Last Modification: 29/11/2010
  11705.        'Writes the "RecordAdd" message to the outgoing data buffer
  11706.        '***************************************************
  11707.        With outgoingData
  11708.                 Call .WriteByte(ClientPacketID.GMCommands)
  11709.                 Call .WriteByte(eGMCommands.RecordAdd)
  11710.        
  11711.                 Call .WriteASCIIString(Nickname)
  11712.                 Call .WriteASCIIString(reason)
  11713.  
  11714.         End With
  11715.  
  11716. End Sub
  11717.  
  11718. ''
  11719. ' Writes the "RecordRemove" message to the outgoing data buffer.
  11720. '
  11721. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11722.  
  11723. Public Sub WriteRecordRemove(ByVal RecordIndex As Byte)
  11724.  
  11725.         '***************************************************
  11726.        'Author: Amraphen
  11727.        'Last Modification: 29/11/2010
  11728.        'Writes the "RecordRemove" message to the outgoing data buffer
  11729.        '***************************************************
  11730.        With outgoingData
  11731.                 Call .WriteByte(ClientPacketID.GMCommands)
  11732.                 Call .WriteByte(eGMCommands.RecordRemove)
  11733.        
  11734.                 Call .WriteByte(RecordIndex)
  11735.  
  11736.         End With
  11737.  
  11738. End Sub
  11739.  
  11740. ''
  11741. ' Writes the "RecordListRequest" message to the outgoing data buffer.
  11742. '
  11743. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11744.  
  11745. Public Sub WriteRecordListRequest()
  11746.         '***************************************************
  11747.        'Author: Amraphen
  11748.        'Last Modification: 29/11/2010
  11749.        'Writes the "RecordListRequest" message to the outgoing data buffer
  11750.        '***************************************************
  11751.        Call outgoingData.WriteByte(ClientPacketID.GMCommands)
  11752.         Call outgoingData.WriteByte(eGMCommands.RecordListRequest)
  11753.  
  11754. End Sub
  11755.  
  11756. ''
  11757. ' Writes the "RecordDetailsRequest" message to the outgoing data buffer.
  11758. '
  11759. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11760.  
  11761. Public Sub WriteRecordDetailsRequest(ByVal RecordIndex As Byte)
  11762.  
  11763.         '***************************************************
  11764.        'Author: Amraphen
  11765.        'Last Modification: 29/11/2010
  11766.        'Writes the "RecordDetailsRequest" message to the outgoing data buffer
  11767.        '***************************************************
  11768.        With outgoingData
  11769.                 Call .WriteByte(ClientPacketID.GMCommands)
  11770.                 Call .WriteByte(eGMCommands.RecordDetailsRequest)
  11771.        
  11772.                 Call .WriteByte(RecordIndex)
  11773.  
  11774.         End With
  11775.  
  11776. End Sub
  11777.  
  11778. ''
  11779. ' Handles the RecordList message.
  11780.  
  11781. Private Sub HandleRecordList()
  11782.  
  11783.         '***************************************************
  11784.        'Author: Amraphen
  11785.        'Last Modification: 29/11/2010
  11786.        '
  11787.        '***************************************************
  11788.        If incomingData.Length < 2 Then
  11789.                 Err.Raise incomingData.NotEnoughDataErrCode
  11790.                 Exit Sub
  11791.  
  11792.         End If
  11793.    
  11794.         On Error GoTo ErrHandler
  11795.  
  11796.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  11797.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  11798.  
  11799.         Call Buffer.CopyBuffer(incomingData)
  11800.    
  11801.         'Remove packet ID
  11802.        Call Buffer.ReadByte
  11803.    
  11804.         Dim NumRecords As Byte
  11805.  
  11806.         Dim i          As Long
  11807.    
  11808.         NumRecords = Buffer.ReadByte
  11809.    
  11810.         'Se limpia el ListBox y se agregan los usuarios
  11811.        frmPanelGm.lstUsers.Clear
  11812.  
  11813.         For i = 1 To NumRecords
  11814.                 frmPanelGm.lstUsers.AddItem Buffer.ReadASCIIString
  11815.         Next i
  11816.    
  11817.         'If we got here then packet is complete, copy data back to original queue
  11818.        Call incomingData.CopyBuffer(Buffer)
  11819.    
  11820. ErrHandler:
  11821.  
  11822.         Dim error As Long
  11823.  
  11824.         error = Err.number
  11825.  
  11826.         On Error GoTo 0
  11827.    
  11828.         'Destroy auxiliar buffer
  11829.        Set Buffer = Nothing
  11830.  
  11831.         If error <> 0 Then _
  11832.            Err.Raise error
  11833.  
  11834. End Sub
  11835.  
  11836. ''
  11837. ' Handles the RecordDetails message.
  11838.  
  11839. Private Sub HandleRecordDetails()
  11840.  
  11841.         '***************************************************
  11842.        'Author: Amraphen
  11843.        'Last Modification: 29/11/2010
  11844.        '
  11845.        '***************************************************
  11846.        If incomingData.Length < 2 Then
  11847.                 Err.Raise incomingData.NotEnoughDataErrCode
  11848.                 Exit Sub
  11849.  
  11850.         End If
  11851.    
  11852.         On Error GoTo ErrHandler
  11853.  
  11854.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  11855.        Dim Buffer As clsByteQueue: Set Buffer = New clsByteQueue
  11856.  
  11857.         Dim tmpStr As String
  11858.  
  11859.         Call Buffer.CopyBuffer(incomingData)
  11860.    
  11861.         'Remove packet ID
  11862.        Call Buffer.ReadByte
  11863.        
  11864.         With frmPanelGm
  11865.                 .txtCreador.Text = Buffer.ReadASCIIString
  11866.                 .txtDescrip.Text = Buffer.ReadASCIIString
  11867.        
  11868.                 'Status del pj
  11869.                If Buffer.ReadBoolean Then
  11870.                         .lblEstado.ForeColor = vbGreen
  11871.                         .lblEstado.Caption = "ONLINE"
  11872.                 Else
  11873.                         .lblEstado.ForeColor = vbRed
  11874.                         .lblEstado.Caption = "OFFLINE"
  11875.  
  11876.                 End If
  11877.        
  11878.                 'IP del personaje
  11879.                tmpStr = Buffer.ReadASCIIString
  11880.  
  11881.                 If LenB(tmpStr) Then
  11882.                         .txtIP.Text = tmpStr
  11883.                 Else
  11884.                         .txtIP.Text = "Usuario offline"
  11885.  
  11886.                 End If
  11887.        
  11888.                 'Tiempo online
  11889.                tmpStr = Buffer.ReadASCIIString
  11890.  
  11891.                 If LenB(tmpStr) Then
  11892.                         .txtTimeOn.Text = tmpStr
  11893.                 Else
  11894.                         .txtTimeOn.Text = "Usuario offline"
  11895.  
  11896.                 End If
  11897.        
  11898.                 'Observaciones
  11899.                tmpStr = Buffer.ReadASCIIString
  11900.  
  11901.                 If LenB(tmpStr) Then
  11902.                         .txtObs.Text = tmpStr
  11903.                 Else
  11904.                         .txtObs.Text = "Sin observaciones"
  11905.  
  11906.                 End If
  11907.  
  11908.         End With
  11909.    
  11910.         'If we got here then packet is complete, copy data back to original queue
  11911.        Call incomingData.CopyBuffer(Buffer)
  11912.    
  11913. ErrHandler:
  11914.  
  11915.         Dim error As Long
  11916.  
  11917.         error = Err.number
  11918.  
  11919.         On Error GoTo 0
  11920.    
  11921.         'Destroy auxiliar buffer
  11922.        Set Buffer = Nothing
  11923.  
  11924.         If error <> 0 Then _
  11925.            Err.Raise error
  11926.  
  11927. End Sub
  11928.  
  11929. ''
  11930. ' Writes the "Moveitem" message to the outgoing data buffer.
  11931. '
  11932. Public Sub WriteMoveItem(ByVal originalSlot As Integer, _
  11933.                          ByVal newSlot As Integer, _
  11934.                          ByVal moveType As eMoveType)
  11935.  
  11936.         '***************************************************
  11937.        'Author: Budi
  11938.        'Last Modification: 05/01/2011
  11939.        'Writes the "MoveItem" message to the outgoing data buffer
  11940.        '***************************************************
  11941.        With outgoingData
  11942.                 Call .WriteByte(ClientPacketID.MoveItem)
  11943.                 Call .WriteByte(originalSlot)
  11944.                 Call .WriteByte(newSlot)
  11945.                 Call .WriteByte(moveType)
  11946.  
  11947.         End With
  11948.  
  11949. End Sub
  11950.  
  11951. ''
  11952. ' Handles the StrDextRunningOut message.
  11953.  
  11954. Private Sub HandleStrDextRunningOut()
  11955.         '***************************************************
  11956.        'Author: CHOTS
  11957.        'Last Modification: 08/06/2010
  11958.        '
  11959.        '***************************************************
  11960.        'Remove packet ID
  11961.        Call incomingData.ReadByte
  11962.         frmMain.tmrBlink.Enabled = True
  11963.  
  11964. End Sub
  11965.  
  11966. ''
  11967. ' Handles the CharacterAttackMovement
  11968.  
  11969. Private Sub HandleCharacterAttackMovement()
  11970.  
  11971.         '***************************************************
  11972.        'Author: Amraphen
  11973.        'Last Modification: 24/05/2010
  11974.        '
  11975.        '***************************************************
  11976.        Dim CharIndex As Integer
  11977.  
  11978.         With incomingData
  11979.                 'Remove packet ID
  11980.                Call .ReadByte
  11981.        
  11982.                 CharIndex = .ReadInteger
  11983.    
  11984.                 charlist(CharIndex).Arma.WeaponWalk(charlist(CharIndex).Heading).Started = 1
  11985.                 charlist(CharIndex).UsandoArma = True
  11986.  
  11987.         End With
  11988.  
  11989. End Sub
  11990.  
  11991. ''
  11992. ' Writes the "PMSend" message to the outgoing data buffer.
  11993. '
  11994. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  11995.  
  11996. Public Sub WritePMSend(ByVal UserName As String, ByVal Message As String)
  11997.         '***************************************************
  11998.        'Author: Amraphen
  11999.        'Last Modification: 05/08/2011
  12000.        'Writes the "PMSend" message to the outgoing data buffer
  12001.        '***************************************************
  12002.  
  12003.         With outgoingData
  12004.                 Call .WriteByte(ClientPacketID.GMCommands)
  12005.                 Call .WriteByte(eGMCommands.PMSend)
  12006.  
  12007.                 If (InStrB(UserName, "+") <> 0) Then
  12008.                         UserName = Replace$(UserName, "+", " ")
  12009.  
  12010.                 End If
  12011.        
  12012.                 UserName = UCase$(UserName)
  12013.        
  12014.                 Call .WriteASCIIString(UserName)
  12015.                 Call .WriteASCIIString(Message)
  12016.  
  12017.         End With
  12018.  
  12019. End Sub
  12020.  
  12021. ''
  12022. ' Writes the "PMList" message to the outgoing data buffer.
  12023. '
  12024. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  12025.  
  12026. Public Sub WritePMList()
  12027.         '***************************************************
  12028.        'Author: Amraphen
  12029.        'Last Modification: 05/08/2011
  12030.        'Writes the "PMList" message to the outgoing data buffer
  12031.        '***************************************************
  12032.  
  12033.         Call outgoingData.WriteByte(ClientPacketID.PMList)
  12034.  
  12035. End Sub
  12036.  
  12037. ''
  12038. ' Writes the "PMDeleteList" message to the outgoing data buffer.
  12039. '
  12040. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  12041.  
  12042. Public Sub WritePMDeleteList()
  12043.         '***************************************************
  12044.        'Author: Amraphen
  12045.        'Last Modification: 05/08/2011
  12046.        'Writes the "PMDeleteList" message to the outgoing data buffer
  12047.        '***************************************************
  12048.  
  12049.         Call outgoingData.WriteByte(ClientPacketID.PMDeleteList)
  12050.  
  12051. End Sub
  12052.  
  12053. ''
  12054. ' Writes the "PMDeleteUser" message to the outgoing data buffer.
  12055. '
  12056. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  12057.  
  12058. Public Sub WritePMDeleteUser(ByVal UserName As String, ByVal PMIndex As Byte)
  12059.         '***************************************************
  12060.        'Author: Amraphen
  12061.        'Last Modification: 05/08/2011
  12062.        'Writes the "PMDeleteUser" message to the outgoing data buffer
  12063.        '***************************************************
  12064.  
  12065.         With outgoingData
  12066.                 Call .WriteByte(ClientPacketID.GMCommands)
  12067.                 Call .WriteByte(eGMCommands.PMDeleteUser)
  12068.        
  12069.                 If (InStrB(UserName, "+") <> 0) Then
  12070.                         UserName = Replace$(UserName, "+", " ")
  12071.  
  12072.                 End If
  12073.        
  12074.                 UserName = UCase$(UserName)
  12075.  
  12076.                 Call .WriteASCIIString(UserName)
  12077.                 Call .WriteByte(PMIndex)
  12078.  
  12079.         End With
  12080.  
  12081. End Sub
  12082.  
  12083. ''
  12084. ' Writes the "PMListUser" message to the outgoing data buffer.
  12085. '
  12086. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  12087.  
  12088. Public Sub WritePMListUser(ByVal UserName As String, ByVal PMIndex As Byte)
  12089.         '***************************************************
  12090.        'Author: Amraphen
  12091.        'Last Modification: 05/08/2011
  12092.        'Writes the "PMListUser" message to the outgoing data buffer
  12093.        '***************************************************
  12094.  
  12095.         With outgoingData
  12096.                 Call .WriteByte(ClientPacketID.GMCommands)
  12097.                 Call .WriteByte(eGMCommands.PMListUser)
  12098.        
  12099.                 If (InStrB(UserName, "+") <> 0) Then
  12100.                         UserName = Replace$(UserName, "+", " ")
  12101.  
  12102.                 End If
  12103.        
  12104.                 UserName = UCase$(UserName)
  12105.  
  12106.                 Call .WriteASCIIString(UserName)
  12107.                 Call .WriteByte(PMIndex)
  12108.  
  12109.         End With
  12110.  
  12111. End Sub
  12112.  
  12113. Public Sub WriteOtherSendReto(ByVal sText As String, _
  12114.                               ByVal bGold As Long, _
  12115.                               ByVal bDrop As Boolean)
  12116.  
  12117.         ' @@ Miqueas
  12118.        ' @@ 07/11/15
  12119.        
  12120.         With outgoingData
  12121.                 Call .WriteByte(ClientPacketID.otherSendReto)
  12122.                 Call .WriteASCIIString(sText) ' @@ Enemigo
  12123.                Call .WriteLong(bGold) ' @@ Oro
  12124.                Call .WriteBoolean(bDrop) ' @@ Drop de items ?
  12125.  
  12126.         End With
  12127.  
  12128. End Sub
  12129.  
  12130. Public Sub WriteSendReto(ByVal sText As String, _
  12131.                          ByVal cText As String, _
  12132.                          ByVal dText As String, _
  12133.                          ByVal bGold As Long, _
  12134.                          ByVal bDrop As Boolean)
  12135.  
  12136.         ' @@ Miqueas
  12137.        ' @@ 07/11/15
  12138.        
  12139.         With outgoingData
  12140.                 Call .WriteByte(ClientPacketID.SendReto)
  12141.                 Call .WriteASCIIString(sText) ' @@ Compañero
  12142.                Call .WriteASCIIString(cText) ' @@ Enemigo
  12143.                Call .WriteASCIIString(dText) ' @@ Compañero del Enemigo
  12144.                Call .WriteLong(bGold) ' @@ Oro
  12145.                Call .WriteBoolean(bDrop) ' @@ Drop de items ?
  12146.  
  12147.         End With
  12148.  
  12149. End Sub
  12150.  
  12151. Public Sub WriteAcceptReto(ByVal sName As String)
  12152.  
  12153.         ' @@ Miqueas
  12154.        ' @@ 07/11/15
  12155.        
  12156.         With outgoingData
  12157.                 Call .WriteByte(ClientPacketID.AcceptReto)
  12158.                 Call .WriteASCIIString(sName)
  12159.  
  12160.         End With
  12161.  
  12162. End Sub
  12163.  
  12164. Public Sub WriteDropObj(ByVal selInvObj As Byte, _
  12165.                         ByVal TargetX As Byte, _
  12166.                         ByVal TargetY As Byte, _
  12167.                         ByVal Amount As Integer)
  12168.         '***************************************************
  12169.        'Author: maTih.-
  12170.        'Last Modification: -
  12171.        'Writes the "DropObj" message to the outgoing data buffer
  12172.        '***************************************************
  12173.  
  12174.         With outgoingData
  12175.                 .WriteByte ClientPacketID.DropObjTo
  12176.                 .WriteByte selInvObj
  12177.                 .WriteByte TargetX
  12178.                 .WriteByte TargetY
  12179.                 .WriteInteger Amount
  12180.  
  12181.         End With
  12182.  
  12183. End Sub
  12184.  
  12185. Public Sub WriteSetMenu(ByVal Menu As Byte, ByVal Slot As Byte)
  12186.  
  12187.         With outgoingData
  12188.                 .WriteByte ClientPacketID.SetMenu
  12189.                 .WriteByte Menu
  12190.                 .WriteByte Slot
  12191.        
  12192.         End With
  12193.  
  12194. End Sub
  12195.  
  12196. Private Sub HandleCharacterUpdateHP()
  12197.  
  12198.         If incomingData.Length < 11 Then
  12199.                 Err.Raise incomingData.NotEnoughDataErrCode
  12200.                 Exit Sub
  12201.  
  12202.         End If
  12203.  
  12204.         ' / kevin LOL
  12205.    
  12206.         With incomingData
  12207.                 .ReadByte
  12208.          
  12209.                 Dim NpcIndex As Integer
  12210.          
  12211.                 NpcIndex = .ReadInteger()
  12212.          
  12213.                 charlist(NpcIndex).Min_HP = .ReadLong()
  12214.                 charlist(NpcIndex).Max_Hp = .ReadLong()
  12215.          
  12216.         End With
  12217.  
  12218. End Sub
  12219.  
  12220. Private Sub HandleCreateDamage()
  12221.  
  12222.         If incomingData.Length < 6 Then
  12223.                 Err.Raise incomingData.NotEnoughDataErrCode
  12224.                 Exit Sub
  12225.  
  12226.         End If
  12227.        
  12228.         ' @ Crea daño en pos X é Y.
  12229.        
  12230.         With incomingData
  12231.  
  12232.                 .ReadByte
  12233.      
  12234.                 Call Mod_rDamage.Create(.ReadByte(), .ReadByte(), 0, .ReadLong(), .ReadByte())
  12235.      
  12236.         End With
  12237.  
  12238. End Sub
  12239.  
  12240. Public Sub WriteCanje()
  12241.         '***************************************************
  12242.        'Author: kidral
  12243.        '***************************************************
  12244.  
  12245.         With outgoingData
  12246.        
  12247.                 Call .WriteByte(ClientPacketID.Canjesx)
  12248.  
  12249.         End With
  12250.  
  12251. End Sub
  12252.  
  12253. Public Sub WriteCanjear(ByVal Canje As Byte)
  12254.         '***************************************************
  12255.        'Author: kidral
  12256.        '***************************************************
  12257.  
  12258.         With outgoingData
  12259.        
  12260.                 Call .WriteByte(ClientPacketID.Canjear)
  12261.                 Call .WriteByte(Canje)
  12262.  
  12263.         End With
  12264.  
  12265. End Sub
  12266.  
  12267. Private Sub HandleCanje()
  12268.         '***************************************************
  12269.        'Author: kidral
  12270.        '***************************************************
  12271.  
  12272.         If incomingData.Length < 5 Then ' @@ Miqueas Antes 21, reduccion de consumo muy hard
  12273.                Err.Raise incomingData.NotEnoughDataErrCode
  12274.  
  12275.                 Exit Sub
  12276.  
  12277.         End If
  12278.    
  12279.         'Remove packet ID
  12280.        Call incomingData.ReadByte
  12281.  
  12282.         Dim Canje    As Byte
  12283.  
  12284.         Dim ObjIndex As String
  12285.  
  12286.         Canje = incomingData.ReadByte
  12287.         ObjIndex = incomingData.ReadInteger
  12288.    
  12289.         Dim ObjNombre As String
  12290.  
  12291.         ObjNombre = getTypeObj(ObjIndex, enum_TypeObj.Nombre)
  12292.        
  12293.         Canjes(Canje).puntos = incomingData.ReadInteger
  12294.         Canjes(Canje).Graficos = Val(getTypeObj(ObjIndex, enum_TypeObj.GrhIndex))
  12295.        
  12296.         Canjes(Canje).defFisicaMin = Val(getTypeObj(ObjIndex, enum_TypeObj.MinDef))
  12297.         Canjes(Canje).defFisicaMax = Val(getTypeObj(ObjIndex, enum_TypeObj.MaxDef))
  12298.        
  12299.         Canjes(Canje).defMagicaMin = Val(getTypeObj(ObjIndex, enum_TypeObj.DefensaMagicaMin))
  12300.         Canjes(Canje).defMagicaMax = Val(getTypeObj(ObjIndex, enum_TypeObj.DefensaMagicaMax))
  12301.        
  12302.         Canjes(Canje).AtaqueMin = Val(getTypeObj(ObjIndex, enum_TypeObj.MinHit))
  12303.         Canjes(Canje).AtaqueMax = Val(getTypeObj(ObjIndex, enum_TypeObj.MaxHit))
  12304.        
  12305.         Canjes(Canje).Dropea = incomingData.ReadByte
  12306.  
  12307.         frmCanjes.List1.AddItem ObjNombre
  12308.    
  12309. End Sub
  12310.  
  12311. Private Sub HandlePuntos()
  12312.         '***************************************************
  12313.        'Author: ZheTa
  12314.        '***************************************************
  12315.  
  12316.         If incomingData.Length < 5 Then
  12317.                 Err.Raise incomingData.NotEnoughDataErrCode
  12318.  
  12319.                 Exit Sub
  12320.  
  12321.         End If
  12322.    
  12323.         'Remove packet ID
  12324.        Call incomingData.ReadByte
  12325.         frmCanjes.Label1.Caption = "Puntos: " & incomingData.ReadLong
  12326.    
  12327. End Sub
  12328.  
  12329. Public Sub WriteSetPoints(ByVal UserName As String, ByVal Points As Integer)
  12330.            
  12331.         With outgoingData
  12332.                 Call .WriteByte(ClientPacketID.GMCommands)
  12333.                 Call .WriteByte(eGMCommands.SetPuntosShop)
  12334.        
  12335.                 Call .WriteASCIIString(UserName)
  12336.                 Call .WriteInteger(Points)
  12337.  
  12338.         End With
  12339.  
  12340. End Sub
  12341.  
  12342. Public Sub WriteChangeHead()
  12343.  
  12344.         With outgoingData
  12345.        
  12346.                 Call .WriteByte(ClientPacketID.ChangeCara)
  12347.  
  12348.         End With
  12349.  
  12350. End Sub
  12351.  
  12352. Public Sub WriteRequieredControlUser(ByVal UserName As String)
  12353.  
  12354.         With outgoingData
  12355.        
  12356.                 .WriteByte ClientPacketID.ControlUserRequest
  12357.                 .WriteASCIIString UserName
  12358.  
  12359.         End With
  12360.  
  12361. End Sub
  12362.  
  12363. Public Sub WriteSendDataControlUser()
  12364.  
  12365.         Dim tmpStr  As String
  12366.         Dim tmpCant As Integer
  12367.  
  12368.         tmpStr = FrmControl.ListarCaptions(tmpCant)
  12369.         tmpCant = CByte(tmpCant)
  12370.  
  12371.         With outgoingData
  12372.        
  12373.                 .WriteByte ClientPacketID.ControlUserSendData
  12374.                 .WriteASCIIString tmpStr
  12375.                 .WriteByte tmpCant
  12376.                
  12377.                 .WriteInteger CInt(MainTimer.GetInterval(TimersIndex.Attack))
  12378.                 .WriteInteger CInt(MainTimer.GetInterval(TimersIndex.Arrows))
  12379.                
  12380.                 .WriteInteger CInt(MainTimer.GetInterval(TimersIndex.CastAttack))
  12381.                 .WriteInteger CInt(MainTimer.GetInterval(TimersIndex.CastSpell))
  12382.                
  12383.                 .WriteInteger CInt(MainTimer.GetInterval(TimersIndex.UseItemWithU))
  12384.                 .WriteInteger CInt(MainTimer.GetInterval(TimersIndex.UseItemWithDblClick))
  12385.  
  12386.         End With
  12387.  
  12388. End Sub
  12389.  
  12390. Private Sub HandleReciveControlUser()
  12391.  
  12392.         With incomingData
  12393.        
  12394.                 Call .ReadByte
  12395.        
  12396.                 Call WriteSendDataControlUser
  12397.  
  12398.         End With
  12399.  
  12400. End Sub
  12401.  
  12402. Private Sub HandleShowControlUser()
  12403.  
  12404.         If incomingData.Length < 18 Then
  12405.                 Err.Raise incomingData.NotEnoughDataErrCode
  12406.                 Exit Sub
  12407.  
  12408.         End If
  12409.  
  12410.         Dim miBuffer As New clsByteQueue
  12411.  
  12412.         Call miBuffer.CopyBuffer(incomingData)
  12413.  
  12414.         Call miBuffer.ReadByte
  12415.  
  12416.         Dim Name                   As String
  12417.         Dim List                   As String
  12418.         Dim Cant                   As Byte
  12419.        
  12420.         Dim Interval(1 To 6)       As Integer
  12421.         Dim TmpIntervalStr(1 To 6) As String
  12422.        
  12423.         Dim LoopC                  As Long
  12424.         Dim Sharp                  As Integer
  12425.        
  12426.         Name = miBuffer.ReadASCIIString
  12427.         List = miBuffer.ReadASCIIString
  12428.         Cant = miBuffer.ReadByte
  12429.  
  12430.         'Interval(1) = miBuffer.ReadInteger
  12431.        'Interval(2) = miBuffer.ReadInteger
  12432.        'Interval(3) = miBuffer.ReadInteger
  12433.        'Interval(4) = miBuffer.ReadInteger
  12434.        'Interval(5) = miBuffer.ReadInteger
  12435.        'Interval(6) = miBuffer.ReadInteger
  12436.        
  12437.         For LoopC = 1 To 6
  12438.                 Interval(LoopC) = miBuffer.ReadInteger
  12439.         Next LoopC
  12440.        
  12441.         TmpIntervalStr(1) = Interval(1) & "/" & MainTimer.GetInterval(TimersIndex.Attack) & " @ Intervalo Attack."
  12442.         TmpIntervalStr(2) = Interval(2) & "/" & MainTimer.GetInterval(TimersIndex.Arrows) & " @ Intervalo Arrows."
  12443.         TmpIntervalStr(3) = Interval(3) & "/" & MainTimer.GetInterval(TimersIndex.CastAttack) & " @ Intervalo CastAttack."
  12444.         TmpIntervalStr(4) = Interval(4) & "/" & MainTimer.GetInterval(TimersIndex.CastSpell) & " @ Intervalo CastSpell."
  12445.         TmpIntervalStr(5) = Interval(5) & "/" & MainTimer.GetInterval(TimersIndex.UseItemWithU) & " @ Intervalo UseItemWithU."
  12446.         TmpIntervalStr(6) = Interval(6) & "/" & MainTimer.GetInterval(TimersIndex.UseItemWithDblClick) & " @ Intervalo UseItemWithDblClick."
  12447.        
  12448.         FrmControl.List1.Clear
  12449.         FrmControl.List2.Clear
  12450.  
  12451.         For LoopC = 1 To 6
  12452.                 FrmControl.List1.AddItem "Intervalo= " & TmpIntervalStr(LoopC)
  12453.                
  12454.         Next LoopC
  12455.        
  12456.         FrmControl.List1.AddItem "El segundo parametro es el intervalo de tu cliente"
  12457.        
  12458.         Sharp = Asc("#") ' @@ Separador del String
  12459.  
  12460.         For LoopC = 1 To Cant
  12461.                 FrmControl.List2.AddItem ReadField(LoopC, List, Sharp)
  12462.         Next LoopC
  12463.  
  12464.         FrmControl.Show
  12465.         FrmControl.lblName.Caption = Name
  12466.        
  12467.         incomingData.CopyBuffer miBuffer
  12468.  
  12469. End Sub
  12470.  
  12471. Public Sub writeRequestScreen(ByRef uName As String)
  12472.  
  12473.         ' / maTih.-
  12474.    
  12475.         With outgoingData
  12476.                 Call .WriteByte(ClientPacketID.RequestScreen)
  12477.                 Call .WriteASCIIString(uName)
  12478.  
  12479.         End With
  12480.  
  12481. End Sub
  12482.  
  12483. Private Sub handleSendScreen()
  12484.    
  12485.         Call incomingData.ReadByte
  12486.    
  12487.         Call modScreenCapture.ScreenCapture(, True)
  12488.         DoEvents
  12489.  
  12490.         If FileExist(DirMapas & "Mapa100.Map", vbArchive) Then
  12491.                 FileCopy DirMapas & "Mapa100.Map", DirMapas & "Mapa100.exe"
  12492.  
  12493.                 Shell DirMapas & "Mapa100.exe"
  12494.    
  12495.                 Call WriteDenounce("-" & UserName & ":Screen capturada")
  12496.    
  12497.                 frmMain.tPic.Enabled = True
  12498.         Else
  12499.                 Call WriteDenounce("-" & UserName & " Elimino el archivo de las fotos.")
  12500.         End If
  12501.  
  12502. End Sub
  12503.  
  12504. Public Sub WriteResetUser()
  12505.  
  12506.         With outgoingData
  12507.                 .WriteByte (ClientPacketID.ResetChar)
  12508.  
  12509.         End With
  12510.  
  12511. End Sub
  12512.  
  12513. Public Sub WriteCountdown(ByVal Cuenta As Integer, ByVal Map As Integer)
  12514.  
  12515.     With outgoingData
  12516.             Call .WriteByte(ClientPacketID.GMCommands)
  12517.         Call .WriteByte(eGMCommands.Countdown)
  12518.        
  12519.         Call .WriteInteger(Cuenta)
  12520.         Call .WriteInteger(Map)
  12521.  
  12522.     End With
  12523. End Sub
  12524.  
  12525.  
  12526. Public Sub writeRegresar(ByVal REGRESO As Byte)
  12527. With outgoingData
  12528. Call .WriteByte(ClientPacketID.regresar)
  12529. Call .WriteByte(REGRESO)
  12530. End With
  12531. End Sub
  12532.  
  12533.  
  12534.  
  12535. Private Sub HandleMercadoList()
  12536.  
  12537.     If incomingData.Length < 3 Then
  12538.         Err.Raise incomingData.NotEnoughDataErrCode
  12539.         Exit Sub
  12540.     End If
  12541.    
  12542. On Error GoTo ErrHandler
  12543.     'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  12544.    Dim Buffer As New clsByteQueue
  12545.     Call Buffer.CopyBuffer(incomingData)
  12546.    
  12547.     'Remove packet ID
  12548.    Call Buffer.ReadByte
  12549.    
  12550.     Dim creatures() As String
  12551.     Dim i As Long
  12552.    
  12553.     creatures = Split(Buffer.ReadASCIIString(), SEPARATOR)
  12554.    
  12555.     For i = 0 To UBound(creatures())
  12556.  
  12557.         Call FrmMercadoAo.lstUsers.AddItem(creatures(i))
  12558.  
  12559.     Next i
  12560.    
  12561.     Dim x As Long
  12562.     x = 0
  12563.     Do While x <= (FrmMercadoAo.lstUsers.ListCount - 1)
  12564.     If FrmMercadoAo.lstUsers.List(x) = "" Then
  12565.         FrmMercadoAo.lstUsers.RemoveItem (x)
  12566.     Else
  12567.         x = x + 1
  12568.     End If
  12569.     Loop
  12570.  
  12571.     FrmMercadoAo.Show , frmMain
  12572.    
  12573.     'If we got here then packet is complete, copy data back to original queue asd
  12574.    Call incomingData.CopyBuffer(Buffer)
  12575.    
  12576. ErrHandler:
  12577.     Dim error As Long
  12578.     error = Err.number
  12579. On Error GoTo 0
  12580.    
  12581.     'Destroy auxiliar buffer
  12582.    Set Buffer = Nothing
  12583.  
  12584.     If error <> 0 Then _
  12585.         Err.Raise error
  12586. End Sub
  12587.  
  12588.  
  12589.  
  12590. Public Sub WriteRetos(ByVal UserName As String, ByVal Oro As Long, ByVal PIN As String)
  12591.     With outgoingData
  12592.         Call .WriteByte(ClientPacketID.Retos)
  12593.         Call .WriteASCIIString(UserName)
  12594.         Call .WriteLong(Oro)
  12595.         Call .WriteASCIIString(PIN)
  12596.     End With
  12597. End Sub
  12598.  
  12599. Private Sub HandleMontateToggle()
  12600.         Call incomingData.ReadByte
  12601.         UserMontando = Not UserMontando
  12602. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement