[Other] Temprament/Estrella Issue Wrong Job Id´s

Results 1 to 5 of 5
  1. #1
    Apprentice Dextan is offline
    MemberRank
    Apr 2011 Join Date
    8Posts

    [Other] Temprament/Estrella Issue Wrong Job Id´s

    We have now Fixed the Estrella core there that we came in caracter creation but if we here follow issue brings a bring problem

    Code:
    [24.10.2015 23:27:12] (Warn) Invalid job ID at char creation from test
    we have update all sutch we find about this in game it shows the msg

    Code:
    // You have chosen wrong class for your avatar
    anyone know why it can be
    or have any idea where the error is

    an other issue is
    the write from passwords in Database think its an simple error

    i post the string from core if anyone find the wrong part let me know

    Code:
     int packetLength = 316;
                int loginLength = 17 + 1;
                int passwordLength = 32 + 1;
    
                string md5 = pPacket.ReadStringForLogin(packetLength);
                char[] md5Char = md5.ToCharArray();
                string username = "";
                string clientPassword = "";
    
                // Read from 0 --> 17
                for (int i = 0; i < loginLength; i++)
                    username += md5Char[i].ToString().Replace("\0", "");
    
                // Read from 260 --> 292
                for (int i = 260; i < 260 + passwordLength; i++)
                    clientPassword += md5Char[i].ToString().Replace("\0", "");
    
                Log.WriteLine(LogLevel.Debug, "{0} tries to login.", username);
    
                DataTable loginData = null;
    
                using (dbClient)
                    loginData = dbClient.ReadDataTable("SELECT * FROM accounts WHERE Username= '" + username + "'");
    
                // Auto account creation if no username found
                if (loginData.Rows.Count == 0)
                {
                    dbClient.ExecuteQuery("INSERT INTO accounts (username, password) VALUES ('" + username + "','" + clientPassword + "')");
    
                    using (dbClient)
                        loginData = dbClient.ReadDataTable("SELECT * FROM accounts WHERE Username= '" + username + "'");
                }
    
                if (loginData != null)
                {
                    if (loginData.Rows.Count > 0)
                    {
                        foreach (DataRow row in loginData.Rows)
                        {
                            string uIsername = (string)row["username"];
                            string password = (string)row["password"];
                            bool banned = Database.DataStore.ReadMethods.EnumToBool(row["banned"].ToString());
    
                            if (clientPassword == password)
                            {
                                if (banned)
                                {
                                    SendFailedLogin(pClient, ServerError.Blocked);
                                    Log.WriteLine(LogLevel.Debug, "Banned user - {0} tries to login.", username);
                                }
    
                                else if (ClientManager.Instance.IsLoggedIn(uIsername))
                                {
                                    Log.WriteLine(LogLevel.Warn, "{0} is trying dual login. Disconnecting.", uIsername);
                                    pClient.Disconnect();
    
                                    break;
                                }
                                else
                                {
                                    pClient.Username = uIsername;
                                    pClient.IsAuthenticated = true;
                                    pClient.Admin = 0; /*(byte)row["Admin"];*/
                                    pClient.AccountID = int.Parse(row["id"].ToString());
                                    WorldList(pClient, false);
                                }


  2. #2
    ExtrinsicStudio™ Myth is offline
    MemberRank
    Jan 2012 Join Date
    367Posts

    Re: [Other] Temprament/Estrella Issue Wrong Job Id´s

    That's some pretty scary looking code and you should validate those fields before running queries, it's 2015 people.

    Anyway, your character creation issue could be anything, how about a snippet of your packet parsing?

  3. #3
    Apprentice Dextan is offline
    MemberRank
    Apr 2011 Join Date
    8Posts

    Re: [Other] Temprament/Estrella Issue Wrong Job Id´s

    all packets are with the newst client syncron only one think how i can find out if there that problem ist this txt string

    anyone eventualy how high is the bite from the job id ??

    Code:
    yte isMaleByte = (byte)((jobGender >> 7) & 0x01);
                byte classIDByte = (byte)((jobGender >> 2) & 0x1F);
                Job job = (Job)classIDByte;
                switch (job)
    my client packet
    Code:
    namespace Zepheus.FiestaLib
    {
        public enum CH2Type : byte
        {
            Pong = 5,
            Unk1 = 13,
        }
    
        public enum CH3Type : byte
        {
            Version = 101,
            Login = 56,
            WorldReRequest = 27,
            FileHash = 4,
            WorldSelect = 11,
            Unk1 = 56,
            //Actually used in World
            WorldClientKey = 15,
            BackToCharSelect = 24,
            Unk2 = 51,
        }
    
        public enum CH4Type : byte
        {
            CharSelect = 1,
    
            ReviveToTown = 78,
            SetPointOnStat = 92,
        }
    
        public enum CH5Type : byte
        {
            CreateCharacter = 1,
            ChangeCharacterName = 5,
            DeleteCharacter = 7,
        }
    
        public enum CH6Type : byte
        {
            TransferKey = 1,
            ClientReady = 4,
            Teleporter = 26,
        }
    
        public enum CH7Type : byte
        {
            UnknownSomethingWithMobs = 1,
        }
        public enum CH14Type : byte
        {
            PartyAccept = 4,
            PartyDecline= 5, 
            PartyReqest = 2,
            PartyLeave = 10,
            PartyMaster = 84,
            PartyInviteGame = 72,   // no data
            ChangePartyMaster = 40,
            ChangePartyDrop = 75,
            KickPartyMember = 20,
    
        }
        public enum CH8Type : byte
        {
            By = 29,
            ByCancel = 11,
            WisperTo = 12,
            ChatNormal = 1,
            ChatParty = 20,
            BeginInteraction = 10,
            Stop = 18,
            Walk = 23,
            Run = 25,
            Shout = 30,
            Emote = 32,
            Jump = 36,
            BeginRest = 39,
            EndRest = 42,
        }
    
        public enum CH9Type : byte
        {
            SelectObject = 1,
            DeselectObject = 8,
    
            AttackEntityMelee = 43,
    
            StopAttackingMelee = 50,
    
            AttackEntitySkill = 61,
            UseSkillWithTarget = 64,
            UseSkillWithPosition = 65,
        }
    
        //items
        public enum CH12Type : byte
        {
            BuyItem = 3,
            SellItem = 6,
            DropItem = 7,
            LootItem = 9,
            MoveItem = 11,
            Equip = 15,
            Unequip = 18,
            UseItem = 21,
            ItemEnhance = 23,
            GetPremiumItemList = 32,
            GetRewardItemList = 44,
            TakeGuildMoney = 47,
            GiveGuildMoney = 49,
        }
    
        public enum CH15Type : byte
        {
            AnswerQuestion = 2,
        }
        public enum CH19Type : byte
        {
            TradeReqest = 1,
            TradeReqestDecline = 3,
            TradeAccept = 6,
            TradeBreak = 10,
            TradeAddItem = 13,
            TradeRemoveItem = 17,
            TradeChangeMoney = 21,
            TradeLock = 25,
            TradeAgree = 31,
        }
        public enum CH20Type : byte
        {
            ByHPStone = 1,
            BySPStone = 2,
            UseHPStone = 7,
            UseSPStone = 9,
        }
        public enum CH21Type : byte
        {
            FriendInvite = 1,
            FriendInviteResponse = 4,
            FriendListDelete = 5,
        }
        public enum CH22Type : byte
        {
            GotIngame = 27,
        }
        public enum CH28Type : byte
        {
            GetQuickBar = 2,
            GetQuickBarState = 4,
            GetGameSettings = 10,
            GetClientSettings = 12,
            GetShortCuts = 14,
    
            SaveQuickBar = 16,
            SaveQuickBarState = 17,
            SaveGameSettings = 20,
            SaveClientSettings = 21,
            SaveShortCuts = 22,
        }
    
        public enum CH29Type : byte
        {
            GetGuildList = 3,
            CreateGuild = 5,
            GuildInviteRequest = 9,
            GuildInviteResponse = 12,
            UpdateGuildMessage = 16,
            UpdateGuildMemberRank = 22,
            LeaveGuild = 28,
            GuildChat = 115,
            GuildNameRequest = 118,
            GuildMemberListRequest = 190,
    
        }
    
        public enum CH31Type : byte
        {
            GetUnknown = 6,
        }
        public enum CH37Type : byte
        {
            MasterRequest = 1,
            MasterRequestResponse = 5,
            RemoveMasterByApprentice = 6,
            MasterRemove = 10,
            MasterRewardCoperRquest= 60,
            SendReciveCoperAccept = 64,
        }
    
        public enum CH38Type : byte
        {
            GetAcademyMemberList = 7,
            GetAcademyList = 11,
            JoinAcademy = 17,
            LeaveAcademy = 27,
            JumpToMember = 31,
            BlockAcademyChat = 33,
            UpdateDetails = 36,
            ChangeRequestToGuild = 44,
            GetAcademyGoldRewardList = 49,
            AcademyChat = 104,
            GuildExtraRequest = 109,
        }
        public enum CH42Type : byte
        {
            AddToBlockList = 3,
            RemoveFromBlockList = 7,
            ClearBlockList = 11,
        }
    }
    ant thats my server packet


    Code:
    namespace Zepheus.FiestaLib
    {
        // Named as SHXType , where X = header ID
    
        public enum SH2Type : byte
        {
            Ping = 4,
            SetXorKeyPosition = 7,
            Chatblock = 72,
            UpdateClientTime = 73,
            UnkTimePacket = 69,
            Unk1 = 14,
        }
        public enum SH19Type : byte
        {
            SendTradeReqest = 2,
            DeclineRequest = 4,
            SendTradeAccept = 9,
            SendTradeBreak = 12,
            SendAddItemSuccefull = 15,
            SendAddItem = 16,
            SendItemRemove = 19,
            SendChangeMoney = 24,
            SendTradeRdy = 27,
            SendTradeLock = 28,
            SendRemoveItemFromHandel = 20,
            SendTradeAgreeMe = 33,
            SendTradeAgreeTo = 34,
            SendTradeComplett = 36,
        }
        public enum SH3Type : byte
        {
            IncorrectVersion = 2, //please update client
            VersionAllowed = 103,
            FilecheckAllow = 5,
            Error = 9,
            WorldlistNew = 10,
            WorldServerIP = 12,
            WorldistResend = 28,
    
            //Actually used in world
            CharacterList = 20,
            Unk = 52,
        }
    
        public enum SH4Type : byte
        {
            Money = 51,
            UpdateStats = 53,
            ConnectError = 2,
            Unk = 222,
            ServerIP = 3,
            CharacterGuildinfo = 18,
            CharacterInfo = 56,
            CharacterLook = 57,
            CharacterQuestsBusy = 58,
            CharacterQuestsDone = 59,
            CharacterActiveSkillList = 61,
            CharacterPassiveSkillList = 62,
            CharacterItemList = 71,
            CharacterInfoEnd = 72,
            CharacterTitles = 73,
            CharacterTimedItemList = 74,
            ReviveWindow = 77,
            Revive = 79,
            CharacterPoints = 91,
            SetPointOnStat = 95,
            CharacterGuildacademyinfo = 151,
        }
    
        public enum SH5Type : byte
        {
            CharCreationError = 4,
            CharCreationOK = 6,
            CharDeleteOK = 12,
            SendCharacterChangeNewName = 16,
        }
    
        public enum SH6Type : byte
        {
            DetailedCharacterInfo = 2,
            Error = 3,
            RemoveDrop = 5,
            ChangeMap = 9,
            ChangeZone = 10,
            TelePorter = 27,
    
        }
    
        public enum SH7Type : byte
        {
            ShowUnequip = 4,
            ShowEquip = 5,
            SpawnSinglePlayer = 6,
            SpawnMultiPlayer = 7,
            SpawnSingleObject = 8,
            SpawnMultiObject = 9,
            ShowDrop = 10,
            ShowDrops = 11,
            RemoveObject = 14,
        }
        public enum SH8Type : byte
        {
            ChatNormal = 2,
            WisperFrom = 13,
            WisperTargetNotfound = 14,
            WisperTo = 15,
            GmNotice = 17,
            StopTele = 19, // Stops char but can teleport
            PartyChat = 21,
            Walk = 24,
            Move = 26,
            Teleport = 27,
            Interaction = 28,
            Shout = 31,
            Emote = 33,
            Jump = 37,
            BeginRest = 40,
            BeginDisplayRest = 41,
            EndRest = 43,
            EndDisplayRest = 44,
            Mounting = 63,
            MapMount = 64,
            Unmount = 66,
            MapUnmount = 67,
            UpdateMountFood = 70,
            CastItem = 71,
            BlockWalk = 74,
        }
    
        public enum SH9Type : byte
        {
            StatUpdate = 2,
            GainExp = 11,
            LevelUP = 12,
            LevelUPAnimation = 13,
            HealHP = 14,
            HealSP = 15,
            SkillAck = 53,
            ResetStance = 61,
            AttackAnimation = 71,
            AttackDamage = 72,
            DieAnimation = 74,
    
            SkillUsePrepareSelf = 78,
            SkillUsePrepareOthers = 79, 
    
            SkillAnimationPosition = 81,
            SkillAnimationTarget = 82,
            SkillAnimation = 87,
        }
    
        public enum SH12Type : byte
        { 
            ModifyItemSlot = 1,
            ModifyEquipSlot = 2,
            InventoryFull = 4,
            ObtainedItem = 10,
            MoveIteminContaInComplet = 12,
            FailedEquip = 17,
            FailedUnequip = 19,
            ItemUseEffect = 22,
            ItemUpgrade = 24,
            ItemUsedOk = 26,
            SendPremiumItemList = 33,
            SendRewardList = 45,
        }
        public enum SH14Type : byte
        {
            // According to my informations, 7 is InviteDeclined.
            // NOTE - IT IS.
    		// Header 7 somehow changed I guess?
    		// seems to be answer or related to CH14::72
    		// new data is CHAR[16] NAME | USHORT UNK (C1 04)
    		// purpose complete unknown
            InviteDeclined = 7,
            UpdatePartyMemberLoc = 73,
            UpdatePartyMemberStats = 50,
            SetMemberStats = 51,
    		// Invite/Accept might be switched up
            PartyInvite = 3,
            PartyAccept = 4,
            PartyDropState = 76,
            PartyList = 9,
    		// changed.
            PartyLeave = 11,
            GroupList = 85,
    		// might changed as well?
            ChangePartyMaster = 41,
            ChangePartyDrop = 75,
            KickPartyMember = 21,
    
            BreakUp = 30,
    
    		// COMPLETE UNKOWN
    		// DATA: CHAR[16] NAME, thats it.
    		UNK_1 = 71,
        }
        public enum SH15Type : byte
        {
            Question = 1,
            HandlerWeapon = 9,
            HanlderSkill = 10,
            HandlerStone = 5,
            HandlerTitel = 11,
            GuildNpcReqest = 12,
        }
    
        //skills & crap?
        public enum SH18Type : byte
        {
            LearnSkill = 4,
        }
    
        public enum SH20Type : byte
        {
            ChangeHPStones = 3,
            ChangeSPStones = 4,
            ErrorBuyStone = 5,
            ErrorUseStone = 6,
            StartHPStoneCooldown = 8,
            StartSPStoneCooldown = 10,
        }
        public enum SH21Type : byte
        {
            FriendListDelete = 6,
            FriendInviteResponse = 2,
            FriendInviteRequest = 3,
            FriendExtraInformation = 8,
            FriendOnline = 9,
            FriendOffline = 10,
            FriendInviteReject = 11,
            FriendDeleteSend = 12,
            FriendChangeMap = 13,
        }
        public enum SH25Type : byte
        {
            WorldMessage = 2,
        }
    
        public enum SH28Type : byte
        {
            LoadQuickBar = 3,
            LoadQuickBarState = 5,
            LoadGameSettings = 11,
            LoadClientSettings = 13,
            LoadShortCuts = 15,
        }
    
        public enum SH29Type : byte
        {
            SendGuildList = 4,
            CreateGuildResponse = 6,
            GuildInviteError = 10,
            GuildInviteRequest = 11,
            UpdateGuildMessageResponse = 17,
            UpdateGuildMemberRankResponse = 23,
            GuildMemberList = 27,
            LeaveGuildResponse = 29,
            ChangeResponse = 39,
            SendUpdateGuildDetails = 45,
            GuildMemberJoined = 54,
            GuildMemberLeft = 56,
            UpdateGuildMemberRank = 57,
            GuildMemberLoggedIn = 61,
            GuildMemberLoggedOut = 62,
            GuildChat = 116,
            GuildNameResult = 119,
            ClearGuildDetailsMessage = 191,
            UnkMessageChange = 196,
    
        }
        public enum SH37Type : byte
        {
            SendMasterRequestAccept = 3,
            SendMasterRequestReponse = 2,
            SendMasterRequest = 4,
            SendMasterResponseRemove = 7,
            SendRemoveMember = 11,
            SendMasterList = 20,
            SendRegisterApprentice = 21,
            SendMasterMemberOnline = 22,
            SendMasterMemberOffline = 23,
            SendApprenticeRemoveMaster = 24,
            SendApprenticeLevelUp = 25,
            SendApprenticeReward = 26,
            SendRecivveCopper = 61,
            SendGiveMasterReward = 65,
            MasterReiveCopperDecline = 69,
        
        }
        public enum SH38Type : byte
        {
            SendAcademyList = 12,
            SendAcademyMemberList = 14,
            AcademyResponse = 18,
            AcademyMemberJoined = 19,
            LeaveAcademyResponse = 28,
            AcademyChatBlockResponse = 35,
            SendChangeDetailsResponse = 37,
            SendChangeDetails = 38,
            SendJoinGuildFromAcademy = 46,
            SendAcademyGoldRewardList = 50,
            AcademyMemberLeft = 96,
            AcademyMemberLoggedIn = 97,
            AcademyMemberLoggedOut = 98,
            AcademyMemberLevelUp = 102,
    
            AcademyChat = 105,
            AcademyChatBlocked = 106,
            GuildItemList = 110,
            RemoveFromGuildStore = 115,
            AddToGuildStore = 117,
        }
        public enum SH42Type : byte
        {
            BlockList = 2,
            AddToBlockList = 6,
            RemoveFromBlockList = 10,
            ClearBlockList = 14,
        }
        public enum SH31Type : byte
        {
            LoadUnkown = 7,
        }
    }
    Last edited by Dextan; 25-10-15 at 03:10 AM.

  4. #4
    Anotha One Wicious is online now
    MemberRank
    Jan 2013 Join Date
    StockholmLocation
    839Posts

    Re: [Other] Temprament/Estrella Issue Wrong Job Id´s

    You should escape your SQL strings for security. Also, breakpoints are there for a reason yaknow. If I remember correctly (It was only hours ago but i'm sleepy) the reason for this error from the zepheus emulator is because the packets are longer and more 00's inbetween.


    World/Handlers/Handler5.cs
    Code:
    string name;
    byte slot, jobGender, hair, color, style;
         if (!packet.TryReadByte(out slot) || !packet.TryReadString(out name, 12) ||
               !packet.TryReadByte(out jobGender) || !packet.TryReadByte(out hair) ||
               !packet.TryReadByte(out color) || !packet.TryReadByte(out style))
    The name string is longer than 12 characters now so when it only reads 12 characters it thinks that what's following is the job/gender variable which then gets filled with a 0 instead of the actual value which comes later.

    Replacing
    Code:
    if (!packet.TryReadByte(out slot) || !packet.TryReadString(out name, 12) ||
    with
    Code:
    if (!packet.TryReadByte(out slot) || !packet.TryReadString(out name, 20) ||
    should fix it


    tadaa
    Screenshot by Lightshot

  5. #5
    Apprentice Dextan is offline
    MemberRank
    Apr 2011 Join Date
    8Posts

    Re: [Other] Temprament/Estrella Issue Wrong Job Id´s

    Quote Originally Posted by Rekt View Post
    You should escape your SQL strings for security. Also, breakpoints are there for a reason yaknow. If I remember correctly (It was only hours ago but i'm sleepy) the reason for this error from the zepheus emulator is because the packets are longer and more 00's inbetween.


    World/Handlers/Handler5.cs
    Code:
    string name;
    byte slot, jobGender, hair, color, style;
         if (!packet.TryReadByte(out slot) || !packet.TryReadString(out name, 12) ||
               !packet.TryReadByte(out jobGender) || !packet.TryReadByte(out hair) ||
               !packet.TryReadByte(out color) || !packet.TryReadByte(out style))
    The name string is longer than 12 characters now so when it only reads 12 characters it thinks that what's following is the job/gender variable which then gets filled with a 0 instead of the actual value which comes later.

    Replacing
    Code:
    if (!packet.TryReadByte(out slot) || !packet.TryReadString(out name, 12) ||
    with
    Code:
    if (!packet.TryReadByte(out slot) || !packet.TryReadString(out name, 20) ||
    should fix it


    tadaa
    Screenshot by Lightshot
    thx a lot it workes perfekt now only is the problem with the pw where database no store the pws



Advertisement