Example #1
0
    public void PrepareOnePlayer(int playerIndex, CharacterInfo[] availableCharacterInfoArr)
    {
        text_PlayerNum.text             = (playerIndex + 1).ToString();
        inputField_PlayerNameInput.text = "";
        text_PlayerNameWarning.enabled  = false;
        nowCharacterList = new List <CharacterHolder> ();


        GUIHelper.Instance.DestroyChildImmediatly <CharacterHolder> (layout_CharacterParent);
        CharacterHolder[] availableCharacterHolderArr = GUIHelper.Instance.InstantiateTUnderParent <CharacterHolder, CharacterInfo>
                                                            (availableCharacterInfoArr, characterHolderPrefab, layout_CharacterParent);

        for (int i = 0; i < availableCharacterHolderArr.Length; i++)
        {
            CharacterHolder thisCharacterHolder = availableCharacterHolderArr [i];

            thisCharacterHolder.SetCharacter(availableCharacterInfoArr [i]);

            thisCharacterHolder.GetComponent <Button> ().onClick.AddListener(delegate {
                onCharacterClick(thisCharacterHolder);
            });

            nowCharacterList.Add(thisCharacterHolder);
        }

        nowCharacterList [0].GetComponent <Button> ().onClick.Invoke();
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     info = GameObject.FindObjectOfType <CharacterHolder>();
     if (manager == null)
     {
         manager = GameObject.FindObjectOfType <SelectionManager>();
     }
 }
Example #3
0
 void Awake()
 {
     if (characterDataString != null)
     {
         CharacterHolder holder = JsonConvert.DeserializeObject <CharacterHolder> (characterDataString.text);
         data = holder.character;
     }
 }
Example #4
0
 public static void Destroy()
 {
     if(instance == null || instance.characters == null) return;
     foreach(Character c in instance.characters.Values){
         GameObject.Destroy(c.gameObject);
     }
     GameObject.Destroy(Instance.mainCharacter.gameObject);
     instance = null;
 }
    void setPlayerReady(int playerID)
    {
        Registration data = registeredPlayers[playerID];

        data.ready = true;
        CharacterHolder characterHolder = data.context.charactersData[data.SelectedCharacterID];

        characterHolder.Select();

        RegisteredPlayerUIView ui = SimplePool.Spawn(playerRegistrationUIPrefab).GetComponent <RegisteredPlayerUIView>();

        Transform UIParent;

        switch (characterHolder.character.side)
        {
        default:
        case Side.LEFT:     //witch
            UIParent = UIParentWitch;
            break;

        case Side.RIGHT:
            UIParent = UIParentAlien;
            break;
        }
        if (data.localID != -1)
        {
            ui.playerColor = possiblePlayers[data.localID].color;
        }
        else
        {
            ui.playerColor = data.color;
        }
        ui.transform.SetParent(UIParent, Vector3.one, false);
        ui.registration = data;
        data.ui         = ui;

        if (data.localID != -1)
        {
            ui.playerName = possiblePlayers[data.localID].name;
        }

        Vector2 echoPosition = data.selector.transform.position;

        Destroy(data.selector.gameObject);
        data.selector = null;

        spawnPlaygroundAvatar(playerID);

        ui.UpdateCharacterSprite(data.SelectedCharacterID);

        data.echoPosition = echoPosition;

        checkReady();
    }
    // Use this for initialization
    void Awake()
    {
        if (CharacterHolder.Instance != null)
        {
            Destroy(gameObject);
            return;
        }

        Instance = this;
        DontDestroyOnLoad(gameObject);

        GetPickedCharacter();
    }
Example #7
0
 public BookWrite(String name)
 {
     // empty booksource
     Cache       = new BookSource();
     DataContext = Cache;
     // TODO continue form the last time
     Cache.Load(name);
     _characterHolder           = new CharacterHolder();
     _sceneHolder               = new SceneHolder();
     _sceneHolder.OnSceneSaved += SceneSaved;
     // initialize UI
     InitializeComponent();
     SelectionPickup();
     ShowProgress("Book loaded");
 }
        static void LoadExecutingAssembly(string[] args)
        {
            //----- Initialize Commons --------------------------------
            Logger.Init();                            //Load Logger
            LocalCommons.Main.InitializeStruct(args); //Initializing LocalCommons.dll

            //--------------- MySQL ---------------------------
            Logger.Section("MySQL");
            CharacterHolder.LoadCharacterData();

            //------ Network ------------------------------------------
            Logger.Section("network connection");
            DelegateList.Initialize(Program.ServerClientVersion);
            InstallLoginServer();
            new AsyncListener(Settings.Default.ArcheAge_IP, Settings.Default.ArcheAge_Port, typeof(ClientConnection)); //Waiting For ArcheAge Connections
        }
Example #9
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }

        var pos = Camera.main.ScreenToWorldPoint(playerPoint.position + Vector3.right * 500f);

        player = Instantiate(playerPrefab, pos, Quaternion.identity).GetComponent <CharacterHolder>();
        DontDestroyOnLoad(player);
    }
Example #10
0
    void onCharacterClick(CharacterHolder targetCharacter)
    {
        selecedCharacter = targetCharacter.Character;

        for (int i = 0; i < nowCharacterList.Count; i++)
        {
            if (nowCharacterList [i].Character.characterName == targetCharacter.Character.characterName)
            {
                nowCharacterList [i].SetSelected(true);
            }
            else
            {
                nowCharacterList [i].SetSelected(false);
            }
        }
    }
        public static void SCUnitVisualOptionsPacket(ClientConnection net)
        {
            uint accountId = net.CurrentAccount.AccountId;

            uint characterId = net.CurrentAccount.Character.CharacterId; // = 1706495; //для теста

            Character chr = CharacterHolder.LoadCharacterData(accountId, characterId);

            string cmd  = "character_option";
            string cmd2 = "g_hide_tutorial 1\r\n";

            net.SendAsync(new NP_SCUnitVisualOptionsPacket_0x01C0(net, chr, cmd, cmd2));

            cmd  = "key_binding";
            cmd2 = "key_binding\r\nprimary\r\n    builtin\r\n        escape open_config\r\n        CTRL-SHIFT-1 godmode\r\n        CTRL-SHIFT-2 flymode\r\n        " +
                   "tab cycle_hostile_forward\r\n        CTRL-tab cycle_friendly_forward\r\n        SHIFT-tab cycle_hostile_backward\r\n        " +
                   "CTRL-SHIFT-tab cycle_friendly_backward\r\n        q moveleft\r\n        CTRL-q toggle_show_guide_decal\r\n        w moveforward\r\n        " +
                   "e moveright\r\n        CTRL-e toggle_post\r\n        CTRL-r toggle_raid_frame\r\n        SHIFT-r toggle_raid_team_manager\r\n        " +
                   "CTRL-SHIFT-r reply_last_whisper\r\n        ALT-SHIFT-r reply_last_whispered\r\n        SHIFT-t toggle_expedition_management\r\n        " +
                   "i toggle_bag\r\n        CTRL-i toggle_gm_console\r\n        o toggle_craft_book\r\n        p toggle_common_farm_info\r\n        " +
                   "enter open_chat\r\n        a turnleft\r\n        s moveback\r\n        d turnright\r\n        f do_interaction_1\r\n        " +
                   "CTRL-f toggle_force_attack\r\n        g do_interaction_2\r\n        h do_interaction_3\r\n        j do_interaction_4\r\n        " +
                   "k toggle_spellbook\r\n        l toggle_quest\r\n        z activate_weapon\r\n        x down\r\n        c toggle_character\r\n        " +
                   "CTRL-v toggle_nametag\r\n        SHIFT-v toggle_friend\r\n        SHIFT-b toggle_commercial_mail\r\n        n toggle_ingameshop\r\n        " +
                   "m toggle_worldmap\r\n        SHIFT-m toggle_craft_research\r\n          toggle_walk\r\n        space jump\r\n        f1 round_target\r\n        " +
                   "ALT-f5 dof_bokeh_circle\r\n        ALT-f6 dof_bokeh_hexagon\r\n        ALT-f7 dof_bokeh_heart\r\n        ALT-f8 dof_bokeh_star\r\n        " +
                   "numlock autorun\r\n        f12 screenshotmode\r\n        CTRL-f12 screenshotcamera\r\n        home right_camera\r\n        " +
                   "ALT-home dof_bokeh_add_size\r\n        CTRL-home dof_add_dist\r\n        SHIFT-up action_bar_page_prev\r\n        " +
                   "pageup cycle_camera_counter_clockwise\r\n        ALT-pageup dof_bokeh_add_intensity\r\n        CTRL-pageup dof_add_range\r\n        " +
                   "end back_camera\r\n        ALT-end dof_bokeh_sub_size\r\n        CTRL-end dof_sub_dist\r\n        SHIFT-down action_bar_page_next\r\n        " +
                   "pagedown cycle_camera_clockwise\r\n        ALT-pagedown dof_bokeh_sub_intensity\r\n        CTRL-pagedown dof_sub_range\r\n        " +
                   "insert front_camera\r\n        ALT-insert dof_bokeh_toggle\r\n        CTRL-insert dof_toggle\r\n        delete left_camera\r\n        " +
                   "CTRL-delete dof_auto_focus\r\n        wheelup screenshot_zoom_in\r\n        CTRL-wheelup builder_zoom_in\r\n        " +
                   "SHIFT-wheelup builder_rotate_left_large\r\n        ALT-wheelup builder_rotate_left_small\r\n        wheeldown screenshot_zoom_out\r\n        " +
                   "CTRL-wheeldown builder_zoom_out\r\n        SHIFT-wheeldown builder_rotate_right_large\r\n        ALT-wheeldown builder_rotate_right_small\r\n        " +
                   "mousedx rotateyaw\r\n        mousedy rotatepitch\r\n        mousedz zooming\r\n    builtin_multi\r\n        action_bar_button\r\n            " +
                   "1 1\r\n            SHIFT-1 13\r\n            2 2\r\n            SHIFT-2 14\r\n            3 3\r\n            SHIFT-3 15\r\n            4 4\r\n            " +
                   "SHIFT-4 16\r\n            5 5\r\n            SHIFT-5 17\r\n            6 6\r\n            SHIFT-6 18\r\n            7 7\r\n            " +
                   "SHIFT-7 19\r\n            8 8\r\n            SHIFT-8 20\r\n            9 9\r\n            SHIFT-9 21\r\n            0 10\r\n            " +
                   "SHIFT-0 22\r\n            minus 11\r\n            SHIFT-minus 23\r\n            equals 12\r\n            SHIFT-equals 24\r\n        " +
                   "mode_action_bar_button ( r 1, t 2, y 3, u 4 )\r\n        team_target ( f2 1, f3 2, f4 3, f5 4 )\r\n        over_head_marker ( f6 1, f7 2, f8 3 )\r\n" +
                   "second\r\n    builtin\r\n        CTRL-ALT-f1 godmode\r\n        ALT-SHIFT-f1 flymode\r\n        up moveforward\r\n        left turnleft\r\n        " +
                   "right turnright\r\n        down moveback\r\n        mouse4 autorun\r\nremoved\r\n";

            net.SendAsync(new NP_SCUnitVisualOptionsPacket_0x01C0(net, chr, cmd, cmd2));
        }
Example #12
0
    void AssignControls()
    {
        Debug.Log("Controls assigned");
        CharacterHolder info = GameObject.FindObjectOfType <CharacterHolder>();

        CharacterHolder.PlayerStats[] stats = new CharacterHolder.PlayerStats[4]
        {
            info.player1, info.player2, info.player3, info.player4
        };

        //switch(playerNumber)
        //{
        //    case 1:
        //        gameObject.SetActive(info.player1.active);
        //        break;
        //    case 2:
        //        gameObject.SetActive(info.player2.active);
        //        break;
        //    case 3:
        //        gameObject.SetActive(info.player3.active);
        //        break;
        //    case 4:
        //        gameObject.SetActive(info.player4.active);
        //        break;
        //}

        bool active = false;

        foreach (CharacterHolder.PlayerStats stat in stats)
        {
            if (stat.colorID == playerNumber - 1)
            {
                controls = CharacterHolder.keyboardControls[stat.keyboardID];
                active   = true;
            }
        }
        gameObject.SetActive(active);
        foreach (GameObject g in turnOffIfInactive)
        {
            g.SetActive(active);
        }

        usingKeyboard    = true;
        controlsAssigned = true;
    }
Example #13
0
        // .method private hidebysig static void Main(string[] args) cil managed
        static void Main(string[] args)
        {
            AccountUid  = new UInt32UidFactory(AccountHolder.MaxAccountUid());     //генерим UID для аккаунтов
            CharcterUid = new UInt32UidFactory(CharacterHolder.MaxCharacterUid()); //генерим UID для персонажей

            Console.Title           = "ARCHEAGE LOGIN SERVER";
            Console.CancelKeyPress += Console_CancelKeyPress;
            Stopwatch watch = Stopwatch.StartNew();

            watch.Start();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            selectVersion();
            LoadExecutingAssembly(args);
            watch.Stop();
            Logger.Trace("ArcheAge Login Server started in {0} seconds", (watch.ElapsedMilliseconds / 1000.0).ToString("0.00"));
            watch = null;
            Key_Pressed();
        }
Example #14
0
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad(this);
     if (singleton == null)
     {
         singleton        = this;
         keyboardControls = new ControlScheme[4]
         {
             keyboard1,
             keyboard2,
             keyboard3,
             keyboard4
         };
     }
     else if (singleton != this)
     {
         Destroy(gameObject);
     }
 }
Example #15
0
        public static UInt24UidFactory LiveObjectUid; //UID для перемещений по карте

        static void Main(string[] args)
        {
            AccountUid = new UInt32UidFactory(AccountHolder.MaxAccountUid());      //генерим UID для аккаунтов
            uint uid = CharacterHolder.MaxCharacterUid();

            CharcterUid = new UInt32UidFactory(uid);   //генерим UID для персонажей
            //ObjectUid = new UInt32UidFactory(CharacterHolder.MaxObjectUid()); //генерим UID для вещей
            ObjectUid     = new UInt32UidFactory();    //TODO: тест, пока начинаем с нуля
            LiveObjectUid = new UInt24UidFactory(uid); //TODO: генерим UID как для персонажей

            Console.Title           = "ARCHEAGE GAME SERVER";
            Console.CancelKeyPress += Console_CancelKeyPress;
            Stopwatch watch = Stopwatch.StartNew();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            selectVersion();
            LoadExecutingAssembly(args);
            watch.Stop();
            Logger.Trace("ArcheAge Game Server started in {0} seconds", (watch.ElapsedMilliseconds / 1000).ToString("0.00"));
            watch = null;
            Key_Pressed();
        }
Example #16
0
    // Use this for initialization
    void Start()
    {
        if (CharacterHolder.Instance != null)
        {
            Destroy(gameObject);
            return;
        }

        Instance = this;
        DontDestroyOnLoad(gameObject);

        var characterIDChoosen = PlayerPrefs.GetInt(GlobalValue.ChoosenCharacterInstanceID, 0);

        foreach (var character in Characters)
        {
            var ID = character.GetInstanceID();
            if (ID == characterIDChoosen)
            {
                CharacterPicked = character;
                return;
            }
        }
    }
        /// <summary>
        /// Send server list
        /// </summary>
        public AcWorldList_0X08(string clientVersion, ArcheAgeConnection net) : base(0x08, true)
        {
            switch (clientVersion)
            {
            case "1":
                ns.Write((byte)1);     // Count
                ns.Write((byte)1);
                string projectName = "AAPlay.ru";
                ns.WriteASCIIFixed(projectName, projectName.Length);
                ns.Write((byte)1);
                ns.Write((short)0);
                ns.Write((short)0);
                ns.Write((int)0);
                ns.Write((short)0);
                ns.Write((byte)1);     // Count
                ns.Write((int)1);
                ns.Write((byte)1);
                ns.Write((int)1);
                projectName = "AAPlay.ru";
                ns.WriteASCIIFixed(projectName, projectName.Length);
                ns.Write((byte)1);
                ns.Write((byte)1);
                projectName = "";
                ns.WriteASCIIFixed(projectName, projectName.Length);
                ns.Write((int)0);
                ns.Write((int)0);
                break;

            case "3":
                /*
                 * [5]             S>c             0ms.            23:03:31 .885      23.06.18
                 * -------------------------------------------------------------------------------
                 * TType: ArcheageServer: LS1     Parse: 6           EnCode: off
                 * ------- 0  1  2  3  4  5  6  7 -  8  9  A  B  C  D  E  F    -------------------
                 * 000000 7F 00 08 00 01 01 01 00 | 09 00 41 72 63 68 65 52     .........ArcheR
                 * 000010 61 67 65 01 00 00 00 00 | 00 00 00 00 00 00 02 1A     age.............
                 * 000020 C7 00 00 00 00 00 00 01 | D7 94 01 00 06 00 52 65     З.......Ч”....Re
                 * 000030 6D 6F 74 61 03 02 10 00 | DC 0D 0C FC D3 E0 18 47     mota....Ь..ьУа.G
                 * 000040 AD 2A 5D 55 EA 47 1C DF | 00 00 00 00 00 00 00 00     ­*]UкG.Я........
                 * 000050 1A C7 00 00 00 00 00 00 | 01 96 E7 01 00 06 00 44     .З.......–з....D
                 * 000060 65 76 65 6C 6F 01 02 10 | 00 CE CB 85 98 F5 41 B0     evelo....ОЛ…˜хA°
                 * 000070 4B A6 74 C7 83 4D DC 5D | 14 00 00 00 00 00 00 00     K¦tЗѓMЬ]........
                 * 000080 00                                                    .
                 * -------------------------------------------------------------------------------
                 * Archeage: "ACWorldList"                      size: 129    prot: 2  $002
                 * Addr:  Size:    Type:         Description:     Value:
                 * 0000     2   word          psize             127        | $007F
                 * 0002     2   word          ID                8          | $0008
                 * 0004     1   byte          count             1          | $01
                 * 0005     1   byte          id                1          | $01
                 * 0006     1   byte          type              1          | $01
                 * 0007     1   byte          color             0          | $00
                 * 0008    11   WideStr[byte] ServerName        ArcheRage  ($)
                 * 0013     1   byte          online            1          | $01
                 * 0014     1   byte          status            0          | $00
                 * 0015     1   byte          __                0          | $00
                 * 0016     1   byte          nuiane            0          | $00
                 * 0017     1   byte          __                0          | $00
                 * 0018     1   byte          dwarf             0          | $00
                 * 0019     1   byte          elf               0          | $00
                 * 001A     1   byte          harniec           0          | $00
                 * 001B     1   byte          ferre             0          | $00
                 * 001C     1   byte          warmozu           0          | $00
                 * 001D     1   byte          a                 0          | $00
                 * 001E     1   byte          chCount           2          | $02
                 * 001F     8   int64         accountId         50970      | $0000C71A
                 * 0027     1   byte          worldId           1          | $01
                 * 0028     4   integer       type              103639     | $000194D7
                 * 002C     8   WideStr[byte] CharName          Remota  ($)
                 * 0034     1   byte          CharRace          гномы  ($03)
                 * 0035     1   byte          CharGender        Ж  ($02)
                 * 0036    18   WideStr[byte] GUID              DC0D0CFCD3E01847AD2A5D55EA471CDF  ($)
                 * 0048     8   int64         v                 0          | $00000000
                 * 0050     8   int64         accountId         50970      | $0000C71A
                 * 0058     1   byte          worldId           1          | $01
                 * 0059     4   integer       type              124822     | $0001E796
                 * 005D     8   WideStr[byte] CharName          Develo  ($)
                 * 0065     1   byte          CharRace          нуиане  ($01)
                 * 0066     1   byte          CharGender        Ж  ($02)
                 * 0067    18   WideStr[byte] GUID              CECB8598F541B04BA674C7834DDC5D14  ($)
                 * 0079     8   int64         v                 0          | $00000000
                 */
                //4E000800  //пробная запись с одним чаром Remota - гномка
                //ns.WriteHex("0101010009004172636865526167650100000000000000000000011AC70000000000000152770100060052656D6F7461030210001F3F1EE73B4D974BA9F5659BA68279570000000000000000");
                //1D000800  //пробная запись - сервер ArcheRage, нет чаров, начало создания
                ////ns.WriteHex("010101000900417263686552616765010000000000000000000000");
                //v.3.0.3.0
                //Посылаем список серверов, количество чаров на аккаунтах
                var m_Current = GameServerController.CurrentGameServers.Values.ToList();
                //Write The number of servers
                ns.Write((byte)m_Current.Count);
                //Информация по серверу
                foreach (var server in m_Current)
                {
                    ns.Write((byte)server.Id);
                    ns.Write((byte)0x01);     //надпись в списке серверов 00-нет надписи, 01- НОВЫЙ, 02-ОБЪЕДИНЕННЫЙ, 03-ОБЪЕДИНЕННЫЙ, 04-нет надписи
                    ns.Write((byte)0x02);     //цвут надписи в списке серверов 00-синий, 01- зеленая, 02-фиолет, 03, 04, 08-красный, 0x10-
                    ns.WriteUTF8Fixed(server.Name, Encoding.UTF8.GetByteCount(server.Name));
                    //ns.WriteASCIIFixed(server.Name, server.Name.Length);
                    var online = server.IsOnline() ? (byte)0x01 : (byte)0x02; //1 Online 2 Offline
                    ns.Write((byte)online);                                   //Server Status - 0x00
                    var status = server.CurrentAuthorized.Count >= server.MaxPlayers ? 0x01 : 0x00;
                    ns.Write((byte)status);                                   //Server Status - 0x00 - normal / 0x01 - load / 0x02 - queue
                    ns.Write((byte)0x00);                                     //unknown
                                                                              //The following sections are the racial restrictions on server creation for this server selection interface 0 Normal 2 Prohibited
                    ns.Write((byte)0x00);                                     //Noah
                    ns.Write((byte)0x00);
                    ns.Write((byte)0x00);                                     //Dwarf family
                    ns.Write((byte)0x00);                                     //Elf
                    ns.Write((byte)0x00);                                     //Haliland
                    ns.Write((byte)0x00);                                     //Animal clan
                    ns.Write((byte)0x00);
                    ns.Write((byte)0x00);                                     //War Mozu
                }

                CharacterHolder.LoadCharacterData();            //считываем героев
                byte CharCount = net.CurrentAccount.Characters; //смотрим сколько героев на аккаунте
                                                                //Write The current user account number
                ns.Write((byte)CharCount);                      //CharCount
                if (CharCount != 0)
                {
                    long m_AccountId = net.CurrentAccount.AccountId;     //считываем только наших героев
                    foreach (Character n_Current in CharacterHolder.CharactersList)
                    {
                        if (n_Current.AccountId == m_AccountId)
                        {
                            ns.Write((long)n_Current.AccountId); //AccountID
                            ns.Write((byte)n_Current.WorldId);   //WorldID
                            ns.Write((int)n_Current.Type);       //type
                            string charname = n_Current.CharName;
                            ns.WriteASCIIFixed(charname, charname.Length);
                            ns.Write((byte)n_Current.CharRace);   //Char Race - 01=нуиане, 03 = гномы
                            ns.Write((byte)n_Current.CharGender); //CharGender - 01-М, 02=Ж
                            string uid = n_Current.GUID;          //UID - Параметры чара
                            ns.WriteHex(uid, uid.Length);
                            ns.Write((long)n_Current.V);          //v
                        }
                    }
                }

                break;

            default:

                break;
            }
        }
Example #18
0
        /// <summary>
        /// пакет для входа в Лобби
        /// CharacterListPacket01_0x0039
        /// author: NLObP
        /// </summary>
        /// <param name="net"></param>
        /// <param name="num">номер по порядку персонажа (от общего количества), которого выводим в пакете</param>
        /// <param name="last">0 - ещё ожидается пакет CharacterList, 1 - последний пакет, больше не будет</param>
        public NP_CharacterListPacket_0x0039(ClientConnection net, int num, int last) : base(01, 0x39)
        {
            var accountId             = net.CurrentAccount.AccountId;
            List <Character> charList = CharacterHolder.LoadCharacterData(accountId);
            var totalChars            = CharacterHolder.GetCount();

            ns.Write((byte)last); //last c
            if (totalChars == 0)
            {
                ns.Write((byte)0); //totalChars); //count c
                return;            //если пустой список, заканчиваем работу
            }
            else
            {
                ns.Write((byte)1); //totalChars); //count c
            }
            int aa = 0;

            foreach (Character chr in charList)
            {
                if (num == aa)                                                                 //параметр NUM отвечает, которого чара выводить в пакете (может быть от 0 до 2)
                {
                    CharacterHolder.LoadEquipPacksData(chr, chr.Ability[0]);                   //дополнительно прочитать NewbieClothPackId, NewbieWeaponPackId из таблицы character_equip_packs
                    CharacterHolder.LoadClothsData(chr, chr.NewbieClothPackId);                //дополнительно прочитать Head,Chest,Legs,Gloves,Feet из таблицы equip_pack_cloths
                    CharacterHolder.LoadWeaponsData(chr, chr.NewbieWeaponPackId);              //дополнительно прочитать Weapon,WeaponExtra,WeaponRanged,Instrument из таблицы equip_pack_weapons
                    CharacterHolder.LoadCharacterBodyCoord(chr, chr.CharRace, chr.CharGender); //дополнительно прочитать body, x, y, z из таблицы charactermodel
                    CharacterHolder.LoadZoneFaction(chr, chr.CharRace, chr.CharGender);        //дополнительно прочитать FactionId,StartingZoneId из таблицы characters

                    ns.Write((int)chr.CharacterId);                                            //type d
                    ns.WriteUTF8Fixed(chr.CharName, chr.CharName.Length);                      //name S
                    ns.Write((byte)chr.CharRace);                                              //CharRace c
                    ns.Write((byte)chr.CharGender);                                            //CharGender c
                    ns.Write((byte)chr.Level);                                                 //level c
                    ns.Write((int)0x001C4);                                                    //health d
                    ns.Write((int)0x001CE);                                                    //mana d
                    ns.Write((int)chr.StartingZoneId);                                         //zid d
                    ns.Write((int)chr.FactionId);                                              //faction_id d
                    string factionName = "";                                                   //factionName SS
                    ns.WriteUTF8Fixed(factionName, factionName.Length);
                    //-----------------------------
                    ns.Write((int)0x00); //type d
                    ns.Write((int)0x00); //family d
                    //<!--  same as in character packets -->

                    /*
                     * инвентарь персонажа
                     */
                    CharacterInfo.WriteItemInfo(net, chr);
                    //<!--  same as in character packets ends-->

                    //for (int i = 0; i < 3; i++)
                    //{
                    ns.Write((byte)chr.Ability[0]); //специализация: 1-FIGHTER нападение, 7-MAGIC волшебство, 6-WILD исцеление,
                                                    //10-LOVE преследование, 5-DEATH мистицизм, 8-VOCATION скрытность
                    ns.Write((byte)chr.Ability[1]); //эффект класса 1
                    ns.Write((byte)chr.Ability[2]); //эффект класса 2
                    //}
                    //position
                    ns.Write((long)Helpers.ConvertLongX(chr.Position.X)); //x Q
                    ns.Write((long)Helpers.ConvertLongY(chr.Position.Y)); //y Q
                    ns.Write((float)chr.Position.Z);                      //z f

                    //<!--  same as in character packets (2) -->
                    CharacterInfo.WriteStaticData(net, chr);
                    //<!--  same as in character packets (2) ends -->

                    ns.Write((short)0x36);        //laborPower h  //очки работы = 5000
                    ns.Write((long)0x532F427F);   //lastLaborPowerModified Q
                    ns.Write((short)0x00);        //deadCount h
                    ns.Write((long)0x532B300C);   //deadTime Q
                    ns.Write((int)0x00);          //rezWaitDuration d
                    ns.Write((long)0x532B300C);   //rezTime Q
                    ns.Write((int)0x00);          //rezPenaltyDuration d
                    ns.Write((long)0x532F41B4);   //lastWorldLeaveTime Q
                    ns.Write((long)0xC2);         //moneyAmount Q  Number of copper coins Automatic 1:100:10000 Convert gold coins  //серебро, золото и платина (начало)
                    ns.Write((long)0x00);         //moneyAmount Q //серебро, золото и платина (продолжение)
                    ns.Write((short)0x00);        //crimePoint h
                    ns.Write((int)0x00);          //crimeRecord d
                    ns.Write((short)0x00);        //crimeScore h
                    ns.Write((long)0x00);         //deleteRequestedTime Q
                    ns.Write((long)0x00);         //transferRequestedTime Q
                    ns.Write((long)0x00);         //deleteDelay Q
                    //ns.Write((int) 0x07); //consumedLp d
                    ns.Write((long)0x1E);         //bmPoint Q  //монеты дару = 30
                    ns.Write((int)0x00);          //consumedLp d ?
                    ns.Write((int)0x00);          //? пришлось вставить для выравнивания длины пакета
                    ns.Write((long)0x00);         //moneyAmount Q
                    ns.Write((long)0x00);         //moneyAmount Q
                    ns.Write((byte)0x00);         //autoUseAApoint A"
                    ns.Write((int)0x00);          //point d
                    ns.Write((int)0x00);          //gift d
                    ns.Write((long)0x00532F3FB3); //updated Q
                }
                ++aa;
            }
        }
        public NP_SCCreateCharacterResponse_0x0033(ClientConnection net, int num, int last) : base(01, 0x0033)
        {
            var accountId             = net.CurrentAccount.AccountId;
            List <Character> charList = CharacterHolder.LoadCharacterData(accountId);
            var totalChars            = CharacterHolder.GetCount();

            //------------------------------------------------------------------------------------------------
            ns.Write((byte)last); //last c
            if (totalChars == 0)
            {
                ns.Write((byte)0); //totalChars); //count c
                return;            //если пустой список, заканчиваем работу
            }
            else
            {
                ns.Write((byte)1); //totalChars); //count c"
            }

            int aa = 0;

            foreach (Character chr in charList)
            {
                if (num == aa)                                            //параметр NUM отвечает, которого чара выводить в пакете (может быть от 0 до 2)
                {
                    ns.Write((int)chr.CharacterId);                       //type d
                    ns.WriteUTF8Fixed(chr.CharName, chr.CharName.Length); //name S
                    ns.Write((byte)chr.CharRace);                         //CharRace c
                    ns.Write((byte)chr.CharGender);                       //CharGender c
                    ns.Write((byte)chr.Level);                            //level c
                    ns.Write((int)0x001C4);                               //health d
                    ns.Write((int)0x001CE);                               //mana d
                    ns.Write((int)179);                                   //starting_zone_id : поле в таблице characters //zid d
                    ns.Write((int)101);                                   //faction_id : поле в таблице characters //type d
                    string factionName = "";                              //factionName SS
                    ns.WriteUTF8Fixed(factionName, factionName.Length);
                    //-----------------------------
                    ns.Write((int)0x00); //type d
                    ns.Write((int)0x00); //family d

                    WriteItem(0);        //костюм
                    WriteItem(0);        //шлем
                    WriteItem(23387);    //нагрудник
                    WriteItem(0);        //пояс
                    WriteItem(23388);    //поножи
                    WriteItem(0);        //наручи
                    WriteItem(23390);    //обувь
                    WriteItem(0);        //плащ
                    WriteItem(0);        //нижнее белье
                    WriteItem(0);        //нижнее белье
                    WriteItem(0);        //ожерелье
                    WriteItem(0);        //серьга
                    WriteItem(0);        //серьга
                    WriteItem(0);        //кольцо
                    WriteItem(0);        //кольцо
                    WriteItem(6102);     //оружие, правая рука
                    WriteItem(0);        //дополнительное оружие, левая рука
                    WriteItem(0);        //WriteItem(6127); //оружие дальноего боя
                    WriteItem(0);        //WriteItem(6202); //инструмент
                    for (int i = 0; i < 7; i++)
                    {
                        ns.Write((int)chr.Type[i]); //type[somehow_special] d
                    }

                    WriteItem(0); //
                    WriteItem(0); //

                    for (int i = 0; i < 3; i++)
                    {
                        ns.Write((byte)chr.Ability[i]); //ability[] c
                    }

                    ns.Write((long)7975971); //x Q
                    ns.Write((long)7875611); //y Q
                    ns.Write((float)226392); //z f

                    ns.Write((byte)chr.Ext); //ext c
                    switch (chr.Ext)
                    {
                    case 0:
                        break;     //</case>

                    case 1:
                        ns.Write((int)chr.Type[7]); //type d
                        break;                      //</case>

                    case 2:
                        ns.Write((int)chr.Type[7]); //type d
                        ns.Write((int)chr.Type[8]); //type d
                        ns.Write((int)chr.Type[9]); //type d
                        break;                      //</case>

                    default:
                        ns.Write((int)chr.Type[7]);      //type d
                        ns.Write((int)chr.Type[8]);      //type d
                        ns.Write((int)chr.Type[9]);      //type d
                        ns.Write((int)chr.Type[10]);     //type d
                        ns.Write((float)chr.Weight[10]); //weight f
                        ns.Write((float)chr.Scale);      //scale f
                        ns.Write((float)chr.Rotate);     //rotate f
                        ns.Write((short)chr.MoveX);      //moveX h
                        ns.Write((short)chr.MoveY);      //moveY h
                        for (int i = 11; i < 15; i++)
                        {
                            ns.Write((int)chr.Type[i]);     //type d
                            ns.Write((float)chr.Weight[i]); //weight f
                        }

                        ns.Write((int)chr.Type[15]);     //type d
                        ns.Write((int)chr.Type[16]);     //type d
                        ns.Write((int)chr.Type[17]);     //type d
                        ns.Write((float)chr.Weight[17]); //weight f
                        ns.Write((int)chr.Lip);          //lip d
                        ns.Write((int)chr.LeftPupil);    //leftPupil d
                        ns.Write((int)chr.RightPupil);   //rightPupil d
                        ns.Write((int)chr.Eyebrow);      //eyebrow d
                        ns.Write((int)chr.Decor);        //decor d
                        //следующая инструкция пишет: len.stringHex
                        //---ns.Write((short)0x00); //modifiers_len h
                        string subString = chr.Modifiers.Substring(0, 256); //надо отрезать в конце два символа \0\0
                        ns.WriteHex(subString, subString.Length);           //modifiers b
                        break;                                              //</case>
                    } //</switch>

                    ns.Write((short)0x36);        //laborPower h //очки работы = 5000
                    ns.Write((long)0x532F427F);   //lastLaborPowerModified Q
                    ns.Write((short)0x00);        //deadCount h
                    ns.Write((long)0x532B300C);   //deadTime Q
                    ns.Write((int)0x00);          //rezWaitDuration d
                    ns.Write((long)0x532B300C);   //rezTime Q
                    ns.Write((int)0x00);          //rezPenaltyDuration d
                    ns.Write((long)0x532F41B4);   //lastWorldLeaveTime Q
                    ns.Write((long)0xC2);         //moneyAmount Q  Number of copper coins Automatic 1:100:10000 Convert gold coins  //серебро, золото и платина (начало)
                    ns.Write((long)0x00);         //moneyAmount Q //серебро, золото и платина (продолжение)
                    ns.Write((short)0x00);        //crimePoint h
                    ns.Write((int)0x00);          //crimeRecord d
                    ns.Write((short)0x00);        //crimeScore h
                    ns.Write((long)0x00);         //deleteRequestedTime Q
                    ns.Write((long)0x00);         //transferRequestedTime Q
                    ns.Write((long)0x00);         //deleteDelay Q
                    ns.Write((int)0x07);          //consumedLp d
                    ns.Write((long)0x1E);         //bmPoint Q  //монеты дару = 30
                    ns.Write((long)0x00);         //moneyAmount Q
                    ns.Write((long)0x00);         //moneyAmount Q
                    ns.Write((byte)0x00);         //autoUseAApoint A
                    ns.Write((int)0x00);          //point d
                    ns.Write((int)0x00);          //gift d
                    ns.Write((long)0x00532F3FB3); //updated Q
                }
                ++aa;
            }
        }
 public override void Start()
 {
     base.Start();
     itemHolder = GetComponent <CharacterHolder>();
 }
        public NP_SCCharacterStatePacket_0x003B(ClientConnection net, uint characterId, byte gm) : base(01, 0x003B)
        {
            var       accountId = net.CurrentAccount.AccountId;
            Character chr       = CharacterHolder.LoadCharacterData(accountId, characterId);

            CharacterHolder.LoadEquipPacksData(chr, chr.Ability[0]);                   //дополнительно прочитать NewbieClothPackId, NewbieWeaponPackId из таблицы character_equip_packs
            CharacterHolder.LoadClothsData(chr, chr.NewbieClothPackId);                //дополнительно прочитать Head,Chest,Legs,Gloves,Feet из таблицы equip_pack_cloths
            CharacterHolder.LoadWeaponsData(chr, chr.NewbieWeaponPackId);              //дополнительно прочитать Weapon,WeaponExtra,WeaponRanged,Instrument из таблицы equip_pack_weapons
            CharacterHolder.LoadCharacterBodyCoord(chr, chr.CharRace, chr.CharGender); //дополнительно прочитать body, x, y, z из таблицы charactermodel
            CharacterHolder.LoadZoneFaction(chr, chr.CharRace, chr.CharGender);        //дополнительно прочитать FactionId,StartingZoneId из таблицы characters


            //  <packet id="0x003B01" name="SCCharacterStatePacket">
            //4205 DD01 3B00 00000000 1000 0E4FC3755AE17949B1F626620F354A93 00000000 FF091A00 0B00 4A757374746F636865636B010203 C4010000 CE010000 B3000000 65000000
            //0000 00000000 00000000
            //{equip 19 slots
            //00000000
            //00000000
            //5B5B00004618C1000000000000000100000001000000005500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B00000000000000000000000000000000
            //00000000
            //5C5B00004718C1000000000000000100000001000000004600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B00000000000000000000000000000000
            //00000000
            //5E5B00004818C1000000000000000100000001000000002300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B00000000000000000000000000000000
            //00000000
            //00000000
            //00000000
            //00000000
            //00000000
            //00000000
            //00000000
            //00000000
            //D61700004918C1000000000000000100000001000000009100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B00000000000000000000000000000000
            //00000000
            //EF1700004A18C1000000000000000100000001000000008200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B00000000000000000000000000000000
            //3A1800004B18C1000000000000000100000001000000008200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B00000000000000000000000000000000
            //}
            //7F4D0000D85D00000000000000000000000000001B020000000000000000000000000000
            //07 a[0]
            //0B a[1]
            //0B a[2]
            //00000000A8B7CF03 x
            //000000006090A603 y
            //EFFC1043         z
            //03BE1000000400000000000000000000000000803F0000803F0000000000000000000000000000803FCF0100000000803FA60000000000803F000000008FC2353F0000000000000000000000000000803FE37B8BFFAFECEFFFAFECEFFF000000FF00000000800000EF00EF00EE0017D40000000000001000000000000000063BB900D800EE00D400281BEBE100E700F037230000000000640000000000000064000000F0000000000000002BD50000006400000000F9000000E000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036007F422F530000000000000C302B5300000000000000000C302B530000000000000000B4412F5300000000C200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001E00000000000000000000000000000000000000000000000000000000000000000000000000000000
            //B33F2F5300
            //0000000000000000000000DBFB17C092070000000000000000000056010000460000000000000000000000000000000000000000000000000000000000000092070000000000000000000000000000000000000000000000000000323200C200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C72C000022A21C5300
            //00000000
            ns.Write((int)0); //iid d
            string guid = "0E4FC3755AE17949B1F626620F354A93";

            ns.WriteHex(guid, guid.Length);                       //guid_len h, guid b
            ns.Write((int)0);                                     //rwd d
            ns.Write((int)chr.CharacterId);                       //type d
            ns.WriteUTF8Fixed(chr.CharName, chr.CharName.Length); //name S

            ns.Write((byte)chr.CharRace);                         //CharRace c
            ns.Write((byte)chr.CharGender);                       //CharGender c
            ns.Write((byte)chr.Level);                            //level c
            ns.Write((int)0x001C4);                               //health d
            ns.Write((int)0x001CE);                               //mana d
            ns.Write((int)chr.StartingZoneId);                    //zid d
            ns.Write((int)chr.FactionId);                         //faction_id d
            string factionName = "";                              //factionName SS

            ns.WriteUTF8Fixed(factionName, factionName.Length);
            //-----------------------------
            ns.Write((int)0x00); //type d
            ns.Write((int)0x00); //family d
            //------------------------------------
            // инвентарь персонажа
            //for (int i = 0; i < 19; i++)
            //{
            //equip_slot
            WriteItem(chr.Head);        //ES_HEAD
            WriteItem(0);               //ES_NECK
            WriteItem(chr.Chest);       //ES_CHEST Нагрудник (ткань, кожа, латы)	23387
            WriteItem(0);               //ES_WAIST
            WriteItem(chr.Legs);        //ES_LEGS Поножи (ткань, кожа, латы) 23388
            WriteItem(chr.Gloves);      //ES_HANDS
            WriteItem(chr.Feet);        //ES_FEET Обувь (ткань, кожа, латы) 23390
            WriteItem(0);               //ES_ARMS
            WriteItem(0);               //ES_BACK
            WriteItem(0);               //ES_EAR_1
            WriteItem(0);               //ES_EAR_2
            WriteItem(0);               //ES_FINGER_1
            WriteItem(0);               //ES_FINGER_2
            WriteItem(0);               //ES_UNDERSHIRT
            WriteItem(0);               //ES_UNDERPANTS
            WriteItem(chr.Weapon);      //ES_MAINHAND Оружие
            WriteItem(chr.WeaponExtra); //ES_OFFHAND Дополнительное оружие
            WriteItem(0);               //ES_RANGED Лук
            WriteItem(0);               //ES_MUSICAL Муз. инструмент (струнный, духовой, ударный)
            //}

            //for (int i = 0; i < 7; i++)
            //{
            ns.Write((int)chr.Type[0]);  //type[somehow_special] d 19839 face
            ns.Write((int)chr.Type[1]);  //type[somehow_special] d 25372 hair_id
            ns.Write((int)chr.Type[2]);  //type[somehow_special] d
            ns.Write((int)chr.Type[3]);  //type[somehow_special] d
            ns.Write((int)chr.Type[4]);  //type[somehow_special] d

            ns.Write((int)chr.CharBody); //type[somehow_special] d 539   body
            ns.Write((int)chr.Type[6]);  //type[somehow_special] d
                                         //}
            //for (int i = 0; i < 2; i++)
            //{
            //equip_slot
            WriteItem(0); //ES_BACKPACK
            WriteItem(0); //ES_COSPLAY
            //}
            //for (int i = 0; i < 3; i++)
            //{
            ns.Write((byte)chr.Ability[0]); //специализация: 1-FIGHTER нападение, 7-MAGIC волшебство, 6-WILD исцеление,
            //10-LOVE преследование, 5-DEATH мистицизм, 8-VOCATION скрытность
            ns.Write((byte)chr.Ability[1]); //эффект класса 1
            ns.Write((byte)chr.Ability[2]); //эффект класса 2
            //}

            /*
             * ns.Write((long)867.27);  //x Q
             * ns.Write((long)779.11);  //y Q
             * ns.Write((float)247.8); //z f
             */
            ns.WriteHex("00000000A8B7CF03");
            ns.WriteHex("000000006090A603");
            ns.WriteHex("43");

            //  <part id="6" name="ext c
            ns.Write((byte)chr.Ext); //ext c
            switch (chr.Ext)
            {
            case 0:
                break;

            case 1:
                ns.Write((int)chr.Type[7]);     //type d
                break;

            case 2:
                ns.Write((int)chr.Type[7]);     //type d
                ns.Write((int)chr.Type[8]);     //type d
                ns.Write((int)chr.Type[9]);     //type d
                break;

            default:
                ns.Write((int)chr.Type[7]);      //type d        4299 hair_color_id
                ns.Write((int)chr.Type[8]);      //type d        4    skin_color_id
                ns.Write((int)chr.Type[9]);      //type d        0
                ns.Write((int)chr.Type[10]);     //type d       0
                ns.Write((float)chr.Weight[10]); //weight f 1
                ns.Write((float)chr.Scale);      //scale f       1
                ns.Write((float)chr.Rotate);     //rotate f     0
                ns.Write((short)chr.MoveX);      //moveX h       0
                ns.Write((short)chr.MoveY);      //moveY h       0
                //for (int i = 11; i < 15; i++)
                //{
                //ns.Write((int)chr.Type[i]); //type d
                //ns.Write((float)chr.Weight[i]); //weight f
                ns.Write((int)chr.Type[11]);     //type d          0    face_fixed_decal_asset_0_id
                ns.Write((float)chr.Weight[11]); //weight f    1    face_fixed_decal_asset_0_weight
                ns.Write((int)chr.Type[12]);     //type d          444  face_fixed_decal_asset_1_id
                ns.Write((float)chr.Weight[12]); //weight f    1    face_fixed_decal_asset_1_weight
                ns.Write((int)chr.Type[13]);     //type d          170  face_fixed_decal_asset_2_id
                ns.Write((float)chr.Weight[13]); //weight f    1    face_fixed_decal_asset_2_weight)
                ns.Write((int)chr.Type[14]);     //type d          0    face_fixed_decal_asset_3_id
                ns.Write((float)chr.Weight[14]); //weight f    0.71 face_fixed_decal_asset_3_weight
                //}

                ns.Write((int)chr.Type[15]);     //type d             0
                ns.Write((int)chr.Type[16]);     //type d             0 face_normal_map_id
                ns.Write((int)chr.Type[17]);     //type d             0
                ns.Write((float)chr.Weight[17]); //weight f       1
                ns.Write((int)chr.Lip);          //lip d                   0
                ns.Write((int)chr.LeftPupil);    //leftPupil d       left_pupil_color
                ns.Write((int)chr.RightPupil);   //rightPupil d     right_pupil_color
                ns.Write((int)chr.Eyebrow);      //eyebrow d           eyebrow_color
                ns.Write((int)chr.Decor);        //decor d               deco_color
                //следующая инструкция пишет: len.stringHex
                //---ns.Write((short)0x00); //modifiers_len h
                string subString = chr.Modifiers.Substring(0, 256); //надо отрезать в конце два символа \0\0
                ns.WriteHex(subString, subString.Length);           //modifiers b"
                break;
            }
            ns.Write((short)0x36);        //laborPower h  //очки работы = 5000
            ns.Write((long)0x532F427F);   //lastLaborPowerModified Q
            ns.Write((short)0x00);        //deadCount h
            ns.Write((long)0x532B300C);   //deadTime Q
            ns.Write((int)0x00);          //rezWaitDuration d
            ns.Write((long)0x532B300C);   //rezTime Q
            ns.Write((int)0x00);          //rezPenaltyDuration d
            ns.Write((long)0x532F41B4);   //lastWorldLeaveTime Q
            ns.Write((long)0xC2);         //moneyAmount Q  Number of copper coins Automatic 1:100:10000 Convert gold coins  //серебро, золото и платина (начало)
            ns.Write((long)0x00);         //moneyAmount Q //серебро, золото и платина (продолжение)
            ns.Write((short)0x00);        //crimePoint h
            ns.Write((int)0x00);          //crimeRecord d
            ns.Write((short)0x00);        //crimeScore h
            ns.Write((long)0x00);         //deleteRequestedTime Q
            ns.Write((long)0x00);         //transferRequestedTime Q
            ns.Write((long)0x00);         //deleteDelay Q
            //ns.Write((int) 0x07); //consumedLp d
            ns.Write((long)0x1E);         //bmPoint Q  //монеты дару = 30
            ns.Write((int)0x00);          //consumedLp d ?
            ns.Write((int)0x00);          //? пришлось вставить для выравнивания длины пакета
            ns.Write((long)0x00);         //moneyAmount Q
            ns.Write((long)0x00);         //moneyAmount Q
            ns.Write((byte)0x00);         //autoUseAApoint A"
            ns.Write((int)0x00);          //point d
            ns.Write((int)0x00);          //gift d
            ns.Write((long)0x00532F3FB3); //updated Q
            //B33F2F5300000000

            ns.Write((float)0x00);      //angles[0] f
            //00000000
            ns.Write((float)0x00);      //angles[1] f
            //00000000
            ns.WriteHex("DBFB17C0");    //angles[2] f
            //DBFB17C0
            ns.Write((int)0x0C17FBDB);  //exp d
            //92070000
            ns.Write((int)0x0792);      //recoverableExp d
            //00000000
            ns.Write((int)0x00);        //returnDistrictId d
            //00000000
            ns.Write((int)0x00);        //returnDistrict d
            //56010000
            ns.Write((int)0x0156);      //resurrectionDistrict d
            //46000000
            ns.Write((int)0x46);        //abilityExp[0] d
            //00000000
            ns.Write((int)0x00);        //abilityExp[1] d
            //00000000
            ns.Write((int)0x00);        //abilityExp[2] d
            //00000000
            ns.Write((int)0x00);        //abilityExp[3] d
            //00000000
            ns.Write((int)0x00);        //abilityExp[4] d
            //00000000
            ns.Write((int)0x00);        //abilityExp[5] d
            //00000000
            ns.Write((int)0x00);        //abilityExp[6] d
            //00000000
            ns.Write((int)0x00);        //abilityExp[7] d
            //92070000
            ns.Write((int)0x0792);      //abilityExp[8] d
            //00000000
            ns.Write((int)0x00);        //abilityExp[9] d
            //00000000
            ns.Write((int)0x00);        //abilityExp[10] d
            //00000000
            ns.Write((int)0x00);        //unreadMail d
            //00000000
            ns.Write((int)0x00);        //unreadMiaMail d
            //00000000
            ns.Write((int)0x00);        //unreadCommercialMail d
            //00000000
            ns.Write((byte)0x32);       //numInvenSlots c
            //32
            ns.Write((short)0x0032);    //numBankSlots h
            //3200
            ns.Write((long)0xc2);       //moneyAmount Q
            //C200000000000000
            ns.Write((long)0x00);       //moneyAmount Q
            //0000000000000000
            ns.Write((long)0x00);       //moneyAmount Q
            //0000000000000000
            ns.Write((long)0x00);       //moneyAmount Q
            //0000000000000000
            ns.Write((byte)0x00);       //autoUseAAPoint C
            //00
            ns.Write((int)0x00);        //juryPoint d
            //00000000
            ns.Write((int)0x00);        //jailSeconds d
            //00000000
            ns.Write((long)0x00);       //bountyMoney Q
            //0000000000000000
            ns.Write((long)0x00);       //bountyTime Q
            //0000000000000000
            ns.Write((int)0x00);        //reportedNo d
            //00000000
            ns.Write((int)0x00);        //suspectedNo d
            //00000000
            ns.Write((int)0x2CC7);      //totalPlayTime d
            //C72C0000
            ns.Write((long)0x531CA222); //createdTime Q
            //22A21C5300000000
            ns.Write((byte)0x00);       //expandedExpert C
            //00
        }
        /// <summary>
        /// пакет для входа в Лобби
        /// CharacterListPacket01_0x0039
        /// author: NLObP
        /// </summary>
        /// <param name="net"></param>
        /// <param name="num">номер по порядку персонажа (от общего количества), которого выводим в пакете</param>
        /// <param name="last">0 - ещё ожидается пакет CharacterList, 1 - последний пакет, больше не будет</param>
        public NP_CharacterListPacket_0x0039(ClientConnection net, int num, int last) : base(01, 0x0039)
        {
            var accountId             = net.CurrentAccount.AccountId;
            List <Character> charList = CharacterHolder.LoadCharacterData(accountId);
            var totalChars            = CharacterHolder.GetCount();

            ns.Write((byte)last); //last c
            if (totalChars == 0)
            {
                ns.Write((byte)0); //totalChars); //count c
                return;            //если пустой список, заканчиваем работу
            }
            else
            {
                ns.Write((byte)1); //totalChars); //count c
            }
            int aa = 0;

            foreach (Character chr in charList)
            {
                if (num == aa)                                                                 //параметр NUM отвечает, которого чара выводить в пакете (может быть от 0 до 2)
                {
                    CharacterHolder.LoadEquipPacksData(chr, chr.Ability[0]);                   //дополнительно прочитать NewbieClothPackId, NewbieWeaponPackId из таблицы character_equip_packs
                    CharacterHolder.LoadClothsData(chr, chr.NewbieClothPackId);                //дополнительно прочитать Head,Chest,Legs,Gloves,Feet из таблицы equip_pack_cloths
                    CharacterHolder.LoadWeaponsData(chr, chr.NewbieWeaponPackId);              //дополнительно прочитать Weapon,WeaponExtra,WeaponRanged,Instrument из таблицы equip_pack_weapons
                    CharacterHolder.LoadCharacterBodyCoord(chr, chr.CharRace, chr.CharGender); //дополнительно прочитать body, x, y, z из таблицы charactermodel
                    CharacterHolder.LoadZoneFaction(chr, chr.CharRace, chr.CharGender);        //дополнительно прочитать FactionId,StartingZoneId из таблицы characters

                    ns.Write((int)chr.CharacterId);                                            //type d
                    ns.WriteUTF8Fixed(chr.CharName, chr.CharName.Length);                      //name S
                    ns.Write((byte)chr.CharRace);                                              //CharRace c
                    ns.Write((byte)chr.CharGender);                                            //CharGender c
                    ns.Write((byte)chr.Level);                                                 //level c
                    ns.Write((int)0x001C4);                                                    //health d
                    ns.Write((int)0x001CE);                                                    //mana d
                    ns.Write((int)chr.StartingZoneId);                                         //zid d
                    ns.Write((int)chr.FactionId);                                              //faction_id d
                    string factionName = "";                                                   //factionName SS
                    ns.WriteUTF8Fixed(factionName, factionName.Length);
                    //-----------------------------
                    ns.Write((int)0x00); //type d
                    ns.Write((int)0x00); //family d
                    //------------------------------------
                    // инвентарь персонажа
                    //------------------------------------
                    // 1.костюм
                    // 2.Шлем (ткань, кожа, латы)
                    // 3.Нагрудник (ткань, кожа, латы)
                    // 4.Пояс (ткань, кожа, латы)
                    // 5.Наручи (ткань, кожа, латы)
                    // 6.Перчатки (ткань, кожа, латы)
                    // 7.Накидка
                    // 8.Поножи (ткань, кожа, латы)
                    // 9.Обувь (ткань, кожа, латы)
                    //10.Ожерелье
                    //11.Серьга
                    //12.Серьга
                    //13.Кольцо
                    //14.Кольцо
                    //15.Оружие
                    //16.Дополнительное оружие
                    //17.Лук
                    //18.Муз. инструмент (струнный, духовой, ударный)
                    //19.Груз (глайдер, торговый груз, местный товар)
                    //for (int i = 0; i < 19; i++)
                    //{
                    //equip_slot
                    WriteItem(chr.Head);         //ES_HEAD
                    WriteItem(0);                //ES_NECK
                    WriteItem(chr.Chest);        //ES_CHEST Нагрудник (ткань, кожа, латы)	23387
                    WriteItem(0);                //ES_WAIST
                    WriteItem(chr.Legs);         //ES_LEGS Поножи (ткань, кожа, латы) 23388
                    WriteItem(chr.Gloves);       //ES_HANDS
                    WriteItem(chr.Feet);         //ES_FEET Обувь (ткань, кожа, латы) 23390
                    WriteItem(0);                //ES_ARMS
                    WriteItem(0);                //ES_BACK
                    WriteItem(0);                //ES_EAR_1
                    WriteItem(0);                //ES_EAR_2
                    WriteItem(0);                //ES_FINGER_1
                    WriteItem(0);                //ES_FINGER_2
                    WriteItem(0);                //ES_UNDERSHIRT
                    WriteItem(0);                //ES_UNDERPANTS
                    WriteItem(chr.Weapon);       //ES_MAINHAND Оружие
                    WriteItem(chr.WeaponExtra);  //ES_OFFHAND Дополнительное оружие
                    WriteItem(chr.WeaponRanged); //ES_RANGED Лук
                    WriteItem(chr.Instrument);   //ES_MUSICAL Муз. инструмент (струнный, духовой, ударный)
                    //}
                    //for (int i = 0; i < 7; i++)
                    //{
                    ns.Write((int)chr.Type[0]);  //type[somehow_special] d 19839 face
                    ns.Write((int)chr.Type[1]);  //type[somehow_special] d 25372 hair_id
                    ns.Write((int)chr.Type[2]);  //type[somehow_special] d
                    ns.Write((int)chr.Type[3]);  //type[somehow_special] d
                    ns.Write((int)chr.Type[4]);  //type[somehow_special] d

                    ns.Write((int)chr.CharBody); //type[somehow_special] d 539   body
                    ns.Write((int)chr.Type[6]);  //type[somehow_special] d
                    //}

                    //for (int i = 0; i < 2; i++)
                    //{
                    //equip_slot
                    WriteItem(0); //ES_BACKPACK
                    WriteItem(0); //ES_COSPLAY
                    //}

                    //for (int i = 0; i < 3; i++)
                    //{
                    ns.Write((byte)chr.Ability[0]); //специализация: 1-FIGHTER нападение, 7-MAGIC волшебство, 6-WILD исцеление,
                                                    //10-LOVE преследование, 5-DEATH мистицизм, 8-VOCATION скрытность
                    ns.Write((byte)chr.Ability[1]); //эффект класса 1
                    ns.Write((byte)chr.Ability[2]); //эффект класса 2
                                                    //}

                    //ns.WriteHex("00000000A8B7CF03");
                    ns.Write((int)0);
                    ns.Write((float)867.27);   //x Q 03cfb7a8 00000000 = 0.0
                    //ns.WriteHex("000000006090A603");
                    ns.Write((int)0);
                    ns.Write((float)779.11); //y Q 03a69060 00000000 =
                    //ns.WriteHex("EFFC1043");
                    ns.Write((float)247.8);  //z f  4310fcef = 144.988

                    ns.Write((byte)chr.Ext); //ext c
                    switch (chr.Ext)
                    {
                    case 0:
                        break;

                    case 1:
                        ns.Write((int)chr.Type[7]);     //type d
                        break;

                    case 2:
                        ns.Write((int)chr.Type[7]);     //type d
                        ns.Write((int)chr.Type[8]);     //type d
                        ns.Write((int)chr.Type[9]);     //type d
                        break;

                    default:
                        ns.Write((int)chr.Type[7]);      //type d        4299 hair_color_id
                        ns.Write((int)chr.Type[8]);      //type d        4    skin_color_id
                        ns.Write((int)chr.Type[9]);      //type d        0
                        ns.Write((int)chr.Type[10]);     //type d       0
                        ns.Write((float)chr.Weight[10]); //weight f 1
                        ns.Write((float)chr.Scale);      //scale f       1
                        ns.Write((float)chr.Rotate);     //rotate f     0
                        ns.Write((short)chr.MoveX);      //moveX h       0
                        ns.Write((short)chr.MoveY);      //moveY h       0
                        //for (int i = 11; i < 15; i++)
                        //{
                        //ns.Write((int)chr.Type[i]); //type d
                        //ns.Write((float)chr.Weight[i]); //weight f
                        ns.Write((int)chr.Type[11]);     //type d          0    face_fixed_decal_asset_0_id
                        ns.Write((float)chr.Weight[11]); //weight f    1    face_fixed_decal_asset_0_weight
                        ns.Write((int)chr.Type[12]);     //type d          444  face_fixed_decal_asset_1_id
                        ns.Write((float)chr.Weight[12]); //weight f    1    face_fixed_decal_asset_1_weight
                        ns.Write((int)chr.Type[13]);     //type d          170  face_fixed_decal_asset_2_id
                        ns.Write((float)chr.Weight[13]); //weight f    1    face_fixed_decal_asset_2_weight)
                        ns.Write((int)chr.Type[14]);     //type d          0    face_fixed_decal_asset_3_id
                        ns.Write((float)chr.Weight[14]); //weight f    0.71 face_fixed_decal_asset_3_weight
                        //}

                        ns.Write((int)chr.Type[15]);     //type d             0
                        ns.Write((int)chr.Type[16]);     //type d             0 face_normal_map_id
                        ns.Write((int)chr.Type[17]);     //type d             0
                        ns.Write((float)chr.Weight[17]); //weight f       1
                        ns.Write((int)chr.Lip);          //lip d                   0
                        ns.Write((int)chr.LeftPupil);    //leftPupil d       left_pupil_color
                        ns.Write((int)chr.RightPupil);   //rightPupil d     right_pupil_color
                        ns.Write((int)chr.Eyebrow);      //eyebrow d           eyebrow_color
                        ns.Write((int)chr.Decor);        //decor d               deco_color
                        //следующая инструкция пишет: len.stringHex
                        //---ns.Write((short)0x00); //modifiers_len h
                        string subString = chr.Modifiers.Substring(0, 256); //надо отрезать в конце два символа \0\0
                        ns.WriteHex(subString, subString.Length);           //modifiers b"
                        break;
                    }

                    ns.Write((short)0x36);        //laborPower h  //очки работы = 5000
                    ns.Write((long)0x532F427F);   //lastLaborPowerModified Q
                    ns.Write((short)0x00);        //deadCount h
                    ns.Write((long)0x532B300C);   //deadTime Q
                    ns.Write((int)0x00);          //rezWaitDuration d
                    ns.Write((long)0x532B300C);   //rezTime Q
                    ns.Write((int)0x00);          //rezPenaltyDuration d
                    ns.Write((long)0x532F41B4);   //lastWorldLeaveTime Q
                    ns.Write((long)0xC2);         //moneyAmount Q  Number of copper coins Automatic 1:100:10000 Convert gold coins  //серебро, золото и платина (начало)
                    ns.Write((long)0x00);         //moneyAmount Q //серебро, золото и платина (продолжение)
                    ns.Write((short)0x00);        //crimePoint h
                    ns.Write((int)0x00);          //crimeRecord d
                    ns.Write((short)0x00);        //crimeScore h
                    ns.Write((long)0x00);         //deleteRequestedTime Q
                    ns.Write((long)0x00);         //transferRequestedTime Q
                    ns.Write((long)0x00);         //deleteDelay Q
                    //ns.Write((int) 0x07); //consumedLp d
                    ns.Write((long)0x1E);         //bmPoint Q  //монеты дару = 30
                    ns.Write((int)0x00);          //consumedLp d ?
                    ns.Write((int)0x00);          //? пришлось вставить для выравнивания длины пакета
                    ns.Write((long)0x00);         //moneyAmount Q
                    ns.Write((long)0x00);         //moneyAmount Q
                    ns.Write((byte)0x00);         //autoUseAApoint A"
                    ns.Write((int)0x00);          //point d
                    ns.Write((int)0x00);          //gift d
                    ns.Write((long)0x00532F3FB3); //updated Q
                }
                ++aa;
            }
        }
        /// <summary>
        /// Send server list
        /// </summary>
        public AcWorldList_0X08(string clientVersion, ArcheAgeConnection net) : base(0x08, true)
        {
            switch (clientVersion)
            {
            case "1":
                var m_Current = GameServerController.CurrentGameServers.Values.ToList();
                ns.Write((byte)m_Current.Count);     // Count
                foreach (var server in m_Current)
                {
                    ns.Write((byte)server.Id);
                    ns.WriteUTF8Fixed(server.Name, Encoding.UTF8.GetByteCount(server.Name));
                    var online = server.IsOnline() ? (byte)0x01 : (byte)0x02; //1 Online 2 Offline
                    ns.Write((byte)online);                                   //Server Status - 0x01
                    switch (online)
                    {
                    case 0:
                        break;

                    default:
                        var status = server.CurrentAuthorized.Count >= server.MaxPlayers ? 0x01 : 0x00;
                        ns.Write((byte)status);         //Server Status - 0x00 - normal / 0x01 - load / 0x02 - queue
                        //The following sections are the racial restrictions on server creation for this server selection interface 0 Normal 2 Prohibited
                        for (int i = 0; i < 9; i++)
                        {
                            ns.Write((byte)0x00);         //rcon
                        }
                        break;
                    }
                }
                int CharCount = CharacterHolder.LoadCharacterData(net.CurrentAccount.AccountId); //считываем данные персонажей и их количество
                ns.Write((byte)CharCount);                                                       //CharCount

                net.CurrentAccount.Characters = (byte)CharCount;

                if (CharCount != 0)
                {
                    long m_AccountId = net.CurrentAccount.AccountId;     //считываем данные только наших персонажей
                    foreach (Character n_Current in CharacterHolder.CharactersList)
                    {
                        if (n_Current.AccountId == m_AccountId)
                        {
                            ns.Write((int)n_Current.AccountId); //AccountID
                            ns.Write((byte)n_Current.WorldId);  //WorldID
                            ns.Write((int)n_Current.Type);      //charID
                            string charname = n_Current.CharName;
                            ns.WriteASCIIFixed(charname, charname.Length);
                            ns.Write((byte)n_Current.CharRace);   //CharRace
                            ns.Write((byte)n_Current.CharGender); //CharGender
                            string uid = n_Current.GUID;          // = ""; //UID - Параметры чара, возможно пустая строка!
                            ns.WriteHex(uid, uid.Length);
                            ns.Write((long)n_Current.V);          //v
                        }
                    }
                }

                AccountHolder.InsertOrUpdate(net.CurrentAccount);

                break;

            case "3":
                //4E000800  //пробная запись с одним чаром Remota - гномка
                //ns.WriteHex("0101010009004172636865526167650100000000000000000000011AC70000000000000152770100060052656D6F7461030210001F3F1EE73B4D974BA9F5659BA68279570000000000000000");
                //1D000800  //пробная запись - сервер ArcheRage, нет чаров, начало создания
                ////ns.WriteHex("010101000900417263686552616765010000000000000000000000");
                //v.3.0.3.0
                //Посылаем список серверов, количество чаров на аккаунтах
                m_Current = GameServerController.CurrentGameServers.Values.ToList();
                //Write The number of servers
                ns.Write((byte)m_Current.Count);
                //Информация по серверу
                foreach (var server in m_Current)
                {
                    ns.Write((byte)server.Id);
                    ns.Write((byte)0x01);     //надпись в списке серверов 00-нет надписи, 01- НОВЫЙ, 02-ОБЪЕДИНЕННЫЙ, 03-ОБЪЕДИНЕННЫЙ, 04-нет надписи
                    ns.Write((byte)0x02);     //цвут надписи в списке серверов 00-синий, 01- зеленая, 02-фиолет, 03, 04, 08-красный, 0x10-
                    ns.WriteUTF8Fixed(server.Name, Encoding.UTF8.GetByteCount(server.Name));
                    //ns.WriteASCIIFixed(server.Name, server.Name.Length);
                    var online = server.IsOnline() ? (byte)0x01 : (byte)0x02;                //1 Online 2 Offline
                    ns.Write((byte)online);                                                  //Server Status - 0x00
                    var status = server.CurrentAuthorized.Count >= server.MaxPlayers ? 0x01 : 0x00;
                    ns.Write((byte)status);                                                  //Server Status - 0x00 - normal / 0x01 - load / 0x02 - queue
                    //The following sections are the racial restrictions on server creation for this server selection interface 0 Normal 2 Prohibited
                    ns.Write((byte)0x00);                                                    //unknown
                    ns.Write((byte)0x00);                                                    //Noah
                    ns.Write((byte)0x00);
                    ns.Write((byte)0x00);                                                    //Dwarf family
                    ns.Write((byte)0x00);                                                    //Elf
                    ns.Write((byte)0x00);                                                    //Haliland
                    ns.Write((byte)0x00);                                                    //Animal clan
                    ns.Write((byte)0x00);
                    ns.Write((byte)0x00);                                                    //War Mozu
                }
                CharCount = CharacterHolder.LoadCharacterData(net.CurrentAccount.AccountId); //считываем данные персонажей и их количество
                //Write The current user account number
                ns.Write((byte)CharCount);                                                   //CharCount
                if (CharCount != 0)
                {
                    long m_AccountId = net.CurrentAccount.AccountId;     //считываем данные только наших персонажей
                    foreach (Character n_Current in CharacterHolder.CharactersList)
                    {
                        if (n_Current.AccountId == m_AccountId)
                        {
                            ns.Write((long)n_Current.AccountId); //AccountID
                            ns.Write((byte)n_Current.WorldId);   //WorldID
                            ns.Write((int)n_Current.Type);       //type
                            string charname = n_Current.CharName;
                            ns.WriteASCIIFixed(charname, charname.Length);
                            ns.Write((byte)n_Current.CharRace);   //Char Race - 01=нуиане, 03 = гномы
                            ns.Write((byte)n_Current.CharGender); //CharGender - 01-М, 02=Ж
                            string uid = n_Current.GUID;          //UID - Параметры чара
                            ns.WriteHex(uid, uid.Length);
                            ns.Write((long)n_Current.V);          //v
                        }
                    }
                }
                break;

            default:
                break;
            }
        }
 // =================================================================================================== Add Character
 /// <summary>
 /// add a character to take to the next scene
 /// </summary>
 /// <param name="player">player 1 or 2?</param>
 /// <param name="chI">charachter slot 1, 2, 3 or 4</param>
 /// <param name="ch">what character</param>
 public void AddCharacter(int player, int chI, CharacterHolder ch)
 {
     _selectedCharacters[player, chI] = ch;
 }
    public void ShowChar(CharacterHolder ch, Character cc, string sfact)
    {
        cc.setCommandPoints();

        var children2 = new List <GameObject> ();

        foreach (Transform child2 in spawnpanel.transform)
        {
            children2.Add(child2.gameObject);
            ////Debug.Log (child.name);
        }
        if (children2.Count > 0)
        {
            children2.ForEach(child2 => Destroy(child2));
        }

        CharacterHolder newChar = Instantiate(ch) as CharacterHolder;

        //				// set to parent
        newChar.transform.SetParent(spawnpanel.transform);
        newChar.CharacterName.text = cc.getName();

        // set characterRank
        cc.setRankIcon(sfact);
        newChar.CharacterRank.texture  = FactionManager.control.Factions [sfact].Ranks [cc.Rank];;
        newChar.CharacterRankName.text = cc.Rank.ToString();

        // set character Type: infantry, recon, tanker, pilot, general
        if (cc.Rank == Character.C_Rank.BrigadierGeneral)
        {
            cc.Type = Character.C_Type.General;
            newChar.CharacterType.text = cc.Type.ToString();

            if (sfact == "US")
            {
                cc.C_Image = USGeneral;
            }
            else if (sfact == "GERMANY")
            {
                cc.C_Image = GERMGeneral;
            }
            else if (sfact == "SOVIET")
            {
                cc.C_Image = SOVGeneral;
            }

            newChar.CharacterImage.texture = cc.C_Image;
        }
        else
        {
            newChar.CharacterType.text     = cc.Type.ToString();
            newChar.CharacterImage.texture = cc.C_Image;
        }


        // set characterFaction
        newChar.CharacterFaction.texture = Resources.Load <Texture> ("Images/FactionFlags/" + sfact);
        // set character assault teams

        //newChar.assault_teams = soldier.DeployList;

        newChar.CharacterUpgrade.onClick.AddListener(() => cc.updateRank());
        //newChar.CharacterUpgrade.onClick.AddListener (() => cc.UIUpdate());
        cc.setRankIcon(sfact);

        if (cc.Type == Character.C_Type.General)
        {
            newChar.CharacterCareerSwitch.gameObject.SetActive(false);
            newChar.cSwitch.gameObject.SetActive(false);
            newChar.ToggleGold.gameObject.SetActive(false);
            if (cc.Rank == Character.C_Rank.GeneralOfTheArmy)
            {
                newChar.CharacterUpgrade.gameObject.SetActive(false);
            }
        }
        else
        {
            newChar.CharacterCareerSwitch.onClick.AddListener(() => cc.SwitchCareer(sfact, newChar.cSwitch.captionText.text, newChar.ToggleGold.isOn));
            //newChar.CharacterCareerSwitch.onClick.AddListener (() => cc.UIUpdate());
            //ch.UIUpdate ();
        }

        newChar.EditEnd.onClick.AddListener(() => cc.setName(newChar.Rename.text));
        //newChar.EditEnd.onClick.AddListener (() => cc.UIUpdate());
    }
Example #26
0
 // Use this for initialization
 void Start()
 {
     controlSchemesInUse = new bool[4];
     colorsInUse         = new bool[4];
     info = GameObject.FindObjectOfType <CharacterHolder>();
 }