public byte[] CharaWorkExp(Socket sender)
        {
            if (PacketQueue == null || PacketQueue.Count == 0)
            {
                Inventory.Update(sender);

                Queue <short> jobLevel    = new Queue <short>();
                Queue <short> jobLevelCap = new Queue <short>();
                int           count       = 0;

                foreach (var item in Jobs)
                {
                    count++;
                    if (count > 52)
                    {
                        break;
                    }
                    Job job = item.Value;
                    jobLevel.Enqueue(job.Level);
                    jobLevelCap.Enqueue(job.LevelCap);
                }

                WorkProperties property = new WorkProperties(sender, Id, @"charaWork/exp");
                property.Add("charaWork.battleSave.skillLevel", jobLevel);
                property.Add("charaWork.battleSave.skillLevelCap", jobLevelCap, true);
                PacketQueue = property.PacketQueue;
            }

            return(PacketQueue.Dequeue());
        }
        public void UpdateExp(Socket sender)
        {
            WorkProperties prop = new WorkProperties(sender, Id, "charaWork/battleStateForSelf");

            prop.Add("charaWork.battleSave.skillPoint[" + (CurrentClassId - 1) + "]", (int)Jobs[CurrentClassId].TotalExp);
            prop.FinishWriting();
        }
        private void UpdateClass(Socket sender)
        {
            WorkProperties property = new WorkProperties(sender, Id, @"charaWork/stateForAll");

            property.Add("charaWork.parameterSave.state_mainSkill[0]", CurrentClassId);
            property.Add("charaWork.parameterSave.state_mainSkillLevel", Jobs[CurrentClassId]);
            property.FinishWriting();
        }
        private void UpdateLevel(Socket sender)
        {
            WorkProperties property = new WorkProperties(sender, Id, @"charaWork/stateForAll");

            property.Add("charaWork.battleSave.skillLevel[" + (CurrentClassId - 1) + "]", Jobs[CurrentClassId].Level);
            property.Add("charaWork.parameterSave.state_mainSkillLevel", Jobs[CurrentClassId].Level);
            property.FinishWriting();
        }
        public void GetWork(Socket sender)
        {
            WorkProperties property = new WorkProperties(sender, Id, @"/_init");



            property.Add("charaWork.eventSave.bazaarTax", (byte)5);
            property.Add("charaWork.battleSave.potencial", 6.6f);

            for (int i = 0; i < 32; i++)
            {
                if (i < 5 && i != 3)
                {
                    property.Add(string.Format("charaWork.property[{0}]", i), (byte)1);
                }
            }

            //Current class info
            Job currentClass = Jobs[CurrentClassId];

            property.Add("charaWork.parameterSave.hp[0]", currentClass.Hp); //always start with HP filled up
            property.Add("charaWork.parameterSave.hpMax[0]", currentClass.MaxHp);
            property.Add("charaWork.parameterSave.mp", currentClass.Mp);    //always start with MP filled up
            property.Add("charaWork.parameterSave.mpMax", currentClass.MaxMp);
            property.Add("charaWork.parameterTemp.tp", currentClass.Tp);

            property.Add("charaWork.parameterSave.state_mainSkill[0]", currentClass.Id);
            property.Add("charaWork.parameterSave.state_mainSkillLevel", (short)currentClass.Level);

            //status buff/ailment timer? database.cs ln 892
            //property.Add(string.Format("charaWork.statusShownTime[{0}]", i), );

            //Write character's parameters
            for (int i = 0; i < GeneralParameters.Count; i++)
            {
                property.Add(string.Format("charaWork.battleTemp.generalParameter[{0}]", i), GeneralParameters[i]);
            }

            //unknown
            property.Add("charaWork.battleTemp.castGauge_speed[0]", 1.0f);
            property.Add("charaWork.battleTemp.castGauge_speed[1]", 0.25f);
            property.Add("charaWork.commandBorder", (byte)0x20);
            property.Add("charaWork.battleSave.negotiationFlag[0]", true);

            //Add character commands
            //DataTable commandTable = GameData.Instance.GetGameData("command");
            //DataRow[] commandRows = commandTable.Select("(id > 0 AND id < 23000) OR (id > 24000 AND id < 26000)"); //(id > 0 AND id < 23000) OR (id > 24000 AND id < 26000)

            //for (int i = 0; i < commandRows.Length; i++)
            //{
            //    uint commandId = (uint)commandRows[i].ItemArray[0];
            //    property.Add(string.Format("charaWork.command[{0}]", i), (0xA0F00000 | (ushort)commandId));
            //}


            //for (int i = 0; i < commandRows.Length; i++)
            //    property.Add(string.Format("charaWork.commandCategory[{0}]", i), (byte)1);


            uint[] command = new uint[64];

            command[0]  = 21001; //active mode
            command[1]  = 21001; //active mode
            command[2]  = 21002; //passive mode
            command[3]  = 12004; //Begin the designated Battle Regimen.
            command[4]  = 21005; //Cast magic quickly at reduced potency.
            command[5]  = 21006; //Stop casting a spell.
            command[6]  = 21007; //use item
            command[7]  = 12009; //equip items
            command[8]  = 12010; //set abilities
            command[9]  = 12005; //attribute points
            command[10] = 12007; //skill change
            command[11] = 12011; //Place marks on enemies to coordinate your party's actions.
            command[12] = 22012; //Bazaar
            command[13] = 22013; //Repair
            command[14] = 29497; //Engage in competitive discourse to win what you seek.
            command[15] = 22015; //[no description]
            //command[16] = 22001; //synthesize
            //command[17] = 24101; //talk
            //command[18] = 24212; //talk

            //hotbar
            command[32] = 27039; //index 32 ~ 61 - hotbar


            //????
            //command[62] = 0xA0F00000 | 27150;
            //command[63] = 0xA0F00000 | 27150;

            for (int i = 0; i < command.Length; i++)
            {
                if (command[i] != 0)
                {
                    property.Add(string.Format("charaWork.command[{0}]", i), 0xA0F00000 | command[i]);
                }
            }

            for (int i = 0; i < 64; i++)
            {
                property.Add(string.Format("charaWork.commandCategory[{0}]", i), (byte)1);
            }


            for (int i = 0; i < 4096; i++)
            {
                property.Add(string.Format("charaWork.commandAcquired[{0}]", 1150), true);
            }

            //job abilities
            for (int i = 0; i < 36; i++)
            {
                property.Add(string.Format("charaWork.additionalCommandAcquired[{0}]", i), true);
            }

            for (int i = 0; i < 40; i++)
            {
                property.Add(string.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", i), true);
            }

            //unknown
            property.Add("charaWork.parameterTemp.forceControl_float_forClientSelf[0]", 1.0f);
            property.Add("charaWork.parameterTemp.forceControl_float_forClientSelf[1]", 1.0f);
            property.Add("charaWork.parameterTemp.forceControl_int16_forClientSelf[0]", (short)-1);
            property.Add("charaWork.parameterTemp.forceControl_int16_forClientSelf[1]", (short)-1);
            property.Add("charaWork.parameterTemp.otherClassAbilityCount[0]", (byte)4);
            property.Add("charaWork.parameterTemp.otherClassAbilityCount[1]", (byte)5);
            property.Add("charaWork.parameterTemp.giftCount[1]", (byte)5);
            property.Add("charaWork.depictionJudge", 0xa0f50911);

            //for (int i = 0; i < 40; i++)
            //property.Add(string.Format("playerWork.questScenario[{0}]", 0), true);

            //GuildLeve - local
            //for (int i = 0; i < 40; i++)
            //property.Add(string.Format("playerWork.questGuildleve[{0}]", (uint)49), true);

            //GuildLeve - regional
            //for(int i = 0; i < 16; i++)
            //{
            //    if (guildLeveId[i] != 0)
            property.Add(string.Format("work.guildleveId[{0}]", 0), 1103);

            //if(guildLeveDone[i]!=0)
            //    property.Add(string.Format("work.guildleveDone[{0}]", i), guildLeveDone[i]);

            //if(guildLeveChecked[i]!=0)
            //    property.Add(string.Format("work.guildleveChecked[{0}]", i), guildLeveChecked[i]);
            //}

            //NPC linkshell
            //for(int i = 0; i < 64; i++)
            //{
            //    //if(npcLinkshellCalling[i])
            //    //    property.Add(string.Format("playerWork.npcLinkshellChatCalling[{0}]", i), true);

            //    //if (npcLinkshellExtra[i])
            //    //    property.Add(string.Format("playerWork.npcLinkshellChatExtra[{0}]", i), true);
            //}


            //ok
            property.Add("playerWork.restBonusExpRate", 0f);

            //From PlayerCharacter obj
            property.Add("playerWork.tribe", Tribe);
            property.Add("playerWork.guardian", Guardian);
            property.Add("playerWork.birthdayMonth", BirthMonth);
            property.Add("playerWork.birthdayDay", BirthDay);
            property.Add("playerWork.initialTown", (byte)InitialTown);

            property.FinishWriting();
        }