public static void UpdateInventory(Client gc, byte SourceType, byte TargetType = 0xFF)
        {
            switch (SourceType)
            {
            case 0:
                UpdateAvatar(gc);
                switch (TargetType)
                {
                case 1:
                    InventoryPacket.getInvenEquip1(gc);
                    break;

                case 2:
                    InventoryPacket.getInvenEquip2(gc);
                    break;

                case 5:
                    InventoryPacket.getInvenPet5(gc);
                    break;
                }

                break;

            case 1:
                if (TargetType == 0)
                {
                    UpdateAvatar(gc);
                }
                InventoryPacket.getInvenEquip1(gc);
                break;

            case 2:
                if (TargetType == 0)
                {
                    UpdateAvatar(gc);
                }
                InventoryPacket.getInvenEquip2(gc);
                break;

            case 3:
                InventoryPacket.getInvenSpend3(gc);
                break;

            case 4:
                InventoryPacket.getInvenOther4(gc);
                break;

            case 5:
                if (TargetType == 0)
                {
                    UpdateAvatar(gc);
                }
                InventoryPacket.getInvenPet5(gc);
                break;
            }
        }
Beispiel #2
0
        public static void Game_Log_Req(InPacket lea, Client gc)
        {
            //int re = SearchBytes(lea.Content, new byte[] { 0x0 });
            string[]  data            = lea.ReadString(0x100 /*re*/).Split(new[] { (char)0x20 }, StringSplitOptions.None);
            int       encryptKey      = int.Parse(data[1]);
            string    username        = data[2];
            string    password        = data[4];
            int       selectCharacter = lea.ReadByte();
            IPAddress hostid          = lea.ReadIPAddress();

            gc.SetAccount(new Account(gc));

            try
            {
                gc.Account.Load(username);
                //var pe = new PasswordEncrypt(encryptKey);
                //string encryptPassword = pe.encrypt(gc.Account.Password, gc.RetryLoginCount > 0 ? password.ToCharArray() : null);

                if (password.Equals(gc.Account.Password))
                {
                    gc.Dispose();
                    Log.Error("Login Fail!");
                }
                else
                {
                    gc.Account.Characters = new List <Character>();
                    foreach (dynamic datum in new Datums("Characters").PopulateWith("id", "accountId = '{0}' ORDER BY position ASC", gc.Account.ID))
                    {
                        Character character = new Character(datum.id, gc);
                        character.Load(false);
                        character.IP = hostid;
                        gc.Account.Characters.Add(character);
                    }
                    gc.SetCharacter(gc.Account.Characters[selectCharacter]);
                }
                Log.Inform("Password = {0}", password);
                //Log.Inform("encryptKey = {0}", encryptKey);
                //Log.Inform("encryptPassword = {0}", encryptPassword);
            }
            catch (NoAccountException)
            {
                gc.Dispose();
                Log.Error("Login Fail!");
            }

            Character chr = gc.Character;

            chr.CharacterID = gc.CharacterID;
            MapFactory.AllCharacters.Add(chr);

            StatusPacket.UpdateHpMp(gc, 0, 0, 0, 0);
            GamePacket.FW_DISCOUNTFACTION(gc);
            StatusPacket.getStatusInfo(gc);
            InventoryPacket.getCharacterEquip(gc);
            SkillPacket.getSkillInfo(gc, chr.Skills.getSkills());
            QuestPacket.getQuestInfo(gc, chr.Quests.getQuests());
            GamePacket.getQuickSlot(gc, chr.Keymap);
            StoragePacket.getStoreInfo(gc);
            StoragePacket.getStoreMoney(gc);
            MapPacket.enterMapStart(gc);
            InventoryPacket.getInvenCash(gc);
            CashShopPacket.MgameCash(gc);
            CashShopPacket.GuiHonCash(gc);
            InventoryPacket.getInvenEquip(gc);
            InventoryPacket.getInvenEquip1(gc);
            InventoryPacket.getInvenEquip2(gc);
            InventoryPacket.getInvenSpend3(gc);
            InventoryPacket.getInvenOther4(gc);
            InventoryPacket.getInvenPet5(gc);
        }