Пример #1
0
        public void Set_ClanInfo(ByteBuffer buff)
        {
            if (this.label_clan_level.InvokeRequired)
            {
                Set_ClanInfo_Callback d = new Set_ClanInfo_Callback(Set_ClanInfo);
                label_clan_level.Invoke(d, new object[] { buff });
                return;
            }

            string clan_name    = "";
            string clan_leader  = "";
            uint   clan_crest   = 0;
            uint   clan_level   = 0;
            uint   clan_castle  = 0;
            uint   clan_hideout = 0;
            uint   my_level     = 0;
            int    clan_rep     = 0;
            uint   ally_id      = 0;
            string ally_name    = "";;
            uint   ally_crest   = 0;
            uint   in_war       = 0;

            buff.ReadUInt32();                  //main or sub pledge 1 = academy, 0 = main
            uint clan_id   = buff.ReadUInt32();
            uint clan_type = buff.ReadUInt32(); //pledge type,  0 = main

            bool update = false;

            if (Globals.gamedata.Chron >= Chronicle.CT3_0)
            {
                switch (clan_type)
                {
                case 0x00:     //main clan
                    clan_name   = buff.ReadString();
                    clan_leader = buff.ReadString();

                    clan_crest = buff.ReadUInt32();
                    clan_level = buff.ReadUInt32();

                    clan_castle  = buff.ReadUInt32();
                    clan_hideout = buff.ReadUInt32();
                    buff.ReadUInt32();     //fort?
                    buff.ReadUInt32();     //rank?
                    my_level = buff.ReadUInt32();
                    clan_rep = buff.ReadInt32();
                    buff.ReadUInt32();    //1 0 0 0
                    buff.ReadUInt32();    //0 0 0 0

                    ally_id    = buff.ReadUInt32();
                    ally_name  = buff.ReadString();
                    ally_crest = buff.ReadUInt32();
                    in_war     = buff.ReadUInt32();
                    buff.ReadUInt32();                       //territory castle id?

                    Globals.ClanMembers = buff.ReadUInt32(); //System.BitConverter.ToInt32(buff,offset);offset+=4;
                    //Globals.l2net_home.Add_Text("Clan name: " + clan_name, Globals.Green, TextType.BOT);
                    //Globals.l2net_home.Add_Text("Clan leader: " + clan_leader, Globals.Green, TextType.BOT);
                    //Globals.l2net_home.Add_Text("Clan crest: " + clan_crest.ToString("X2"), Globals.Green, TextType.BOT);
                    //Globals.l2net_home.Add_Text("Clan level: " + clan_level.ToString(), Globals.Green, TextType.BOT);
                    //Globals.l2net_home.Add_Text("Clan rep: " + clan_rep.ToString(), Globals.Green, TextType.BOT);
                    //Globals.l2net_home.Add_Text("Ally name: " + ally_name, Globals.Green, TextType.BOT);
                    //Globals.l2net_home.Add_Text("Clan members: " + Globals.ClanMembers.ToString(), Globals.Green, TextType.BOT);



                    Globals.ClanOnline = 0;

                    listView_char_clan.BeginUpdate();

                    listView_char_clan.Items.Clear();
                    for (uint i = 0; i < Globals.ClanMembers; i++)
                    {
                        Set_MemberInfo(buff, false);
                    }

                    listView_char_clan.EndUpdate();
                    update = true;
                    break;

                case 0x64000000:     //1st royal guard
                    break;

                case 0xC8000000:     //2nd royal guard
                    break;

                case 0xE9030000:     //1st order of knights
                    break;

                case 0xEA030000:     //2nd order of knights
                    break;

                case 0xD1070000:     //3rd order of knights
                    break;

                case 0xD2070000:     //4th order of knights
                    break;

                case 0xFFFFFFFF:     //academy
                    break;
                }
            }
            else
            {
                clan_name   = buff.ReadString();
                clan_leader = buff.ReadString();

                clan_crest = buff.ReadUInt32();
                clan_level = buff.ReadUInt32();

                clan_castle  = buff.ReadUInt32();
                clan_hideout = buff.ReadUInt32();
                my_level     = buff.ReadUInt32();
                clan_rep     = buff.ReadInt32();
                buff.ReadUInt32(); //1 0 0 0
                buff.ReadUInt32(); //0 0 0 0
                buff.ReadUInt32(); //0 0 0 0

                ally_id    = buff.ReadUInt32();
                ally_name  = buff.ReadString();
                ally_crest = buff.ReadUInt32();
                in_war     = buff.ReadUInt32();

                Globals.ClanMembers = buff.ReadUInt32();//System.BitConverter.ToInt32(buff,offset);offset+=4;
                //Globals.l2net_home.Add_Text("Clan members: " + Globals.ClanMembers.ToString(), Globals.Green, TextType.BOT);


                Globals.ClanOnline = 0;

                listView_char_clan.BeginUpdate();
                //listView_char_clan.ListViewItemSorter = null;

                listView_char_clan.Items.Clear();
                for (uint i = 0; i < Globals.ClanMembers; i++)
                {
                    Set_MemberInfo(buff, false);
                }

                //listView_char_clan.ListViewItemSorter = lvwColumnSorter_clan;
                listView_char_clan.EndUpdate();
                update = true;
            }

            if (update)
            {
                label_clan_name.Text   = clan_name;
                label_clan_leader.Text = clan_leader;
                label_clan_level.Text  = clan_level.ToString();
                label_clan_castle.Text = clan_castle.ToString();
                label_clan_hall.Text   = clan_hideout.ToString();
                label_clan_rep.Text    = clan_rep.ToString();
                label_clan_war.Text    = in_war.ToString();
                label_caln_ally.Text   = ally_name;
                label_clan_online.Text = Globals.m_ResourceManager.GetString("col_Online") + ": " + Globals.ClanOnline.ToString() + "/" + Globals.ClanMembers.ToString();

                try
                {
                    if (pictureBox_clan_crest.BackgroundImage != null)
                    {
                        pictureBox_clan_crest.BackgroundImage.Dispose();
                        pictureBox_clan_crest.BackgroundImage = null;
                    }
                    string path = Globals.PATH + "\\crests\\" + clan_crest.ToString() + ".bmp";


                    //Globals.l2net_home.Add_Text("Crest location pre: " + path);
                    pictureBox_clan_crest.BackgroundImage = new System.Drawing.Bitmap(path);
                    //Globals.l2net_home.Add_Text("Crest location: " +path);
                }
                catch (Exception e)
                {
                    pictureBox_clan_crest.BackgroundImage = new System.Drawing.Bitmap(16, 8);
                    Globals.l2net_home.Add_Text("Exception: " + e.Message, Globals.Green, TextType.BOT);
                }
            }
        }
Пример #2
0
        public void Set_ClanInfo(ByteBuffer buff)
        {
            if (this.label_clan_level.InvokeRequired)
            {
                Set_ClanInfo_Callback d = new Set_ClanInfo_Callback(Set_ClanInfo);
                label_clan_level.Invoke(d, new object[] { buff });
                return;
            }

            string clan_name = "";
            string clan_leader = "";
            uint clan_crest = 0;
            uint clan_level = 0;
            uint clan_castle = 0;
            uint clan_hideout = 0;
            uint my_level = 0;
            int clan_rep = 0;
            uint ally_id = 0;
            string ally_name = ""; ;
            uint ally_crest = 0;
            uint in_war = 0;

            buff.ReadUInt32();//main or sub pledge 1 = academy, 0 = main
            uint clan_id = buff.ReadUInt32();
            uint clan_type = buff.ReadUInt32();//pledge type,  0 = main

            bool update = false;

            if (Globals.gamedata.Chron >= Chronicle.CT3_0)
            {
                switch (clan_type)
                {
                    case 0x00: //main clan
                        clan_name = buff.ReadString();
                        clan_leader = buff.ReadString();

                        clan_crest = buff.ReadUInt32();
                        clan_level = buff.ReadUInt32();

                        clan_castle = buff.ReadUInt32();
                        clan_hideout = buff.ReadUInt32();
                        buff.ReadUInt32(); //fort?
                        buff.ReadUInt32(); //rank?
                        my_level = buff.ReadUInt32();
                        clan_rep = buff.ReadInt32();
                        buff.ReadUInt32();//1 0 0 0
                        buff.ReadUInt32();//0 0 0 0

                        ally_id = buff.ReadUInt32();
                        ally_name = buff.ReadString();
                        ally_crest = buff.ReadUInt32();
                        in_war = buff.ReadUInt32();
                        buff.ReadUInt32(); //territory castle id?

                        Globals.ClanMembers = buff.ReadUInt32();//System.BitConverter.ToInt32(buff,offset);offset+=4;
                        //Globals.l2net_home.Add_Text("Clan name: " + clan_name, Globals.Green, TextType.BOT);
                        //Globals.l2net_home.Add_Text("Clan leader: " + clan_leader, Globals.Green, TextType.BOT);
                        //Globals.l2net_home.Add_Text("Clan crest: " + clan_crest.ToString("X2"), Globals.Green, TextType.BOT);
                        //Globals.l2net_home.Add_Text("Clan level: " + clan_level.ToString(), Globals.Green, TextType.BOT);
                        //Globals.l2net_home.Add_Text("Clan rep: " + clan_rep.ToString(), Globals.Green, TextType.BOT);
                        //Globals.l2net_home.Add_Text("Ally name: " + ally_name, Globals.Green, TextType.BOT);
                        //Globals.l2net_home.Add_Text("Clan members: " + Globals.ClanMembers.ToString(), Globals.Green, TextType.BOT);



                        Globals.ClanOnline = 0;

                        listView_char_clan.BeginUpdate();

                        listView_char_clan.Items.Clear();
                        for (uint i = 0; i < Globals.ClanMembers; i++)
                        {
                            Set_MemberInfo(buff, false);
                        }

                        listView_char_clan.EndUpdate();
                        update = true;
                        break;
                    case 0x64000000: //1st royal guard
                        break;
                    case 0xC8000000: //2nd royal guard
                        break;
                    case 0xE9030000: //1st order of knights
                        break;
                    case 0xEA030000: //2nd order of knights
                        break;
                    case 0xD1070000: //3rd order of knights
                        break;
                    case 0xD2070000: //4th order of knights
                        break;
                    case 0xFFFFFFFF: //academy
                        break;
                }


            }
            else
            {
                clan_name = buff.ReadString();
                clan_leader = buff.ReadString();

                clan_crest = buff.ReadUInt32();
                clan_level = buff.ReadUInt32();

                clan_castle = buff.ReadUInt32();
                clan_hideout = buff.ReadUInt32();
                my_level = buff.ReadUInt32();
                clan_rep = buff.ReadInt32();
                buff.ReadUInt32();//1 0 0 0
                buff.ReadUInt32();//0 0 0 0
                buff.ReadUInt32();//0 0 0 0

                ally_id = buff.ReadUInt32();
                ally_name = buff.ReadString();
                ally_crest = buff.ReadUInt32();
                in_war = buff.ReadUInt32();

                Globals.ClanMembers = buff.ReadUInt32();//System.BitConverter.ToInt32(buff,offset);offset+=4;
                //Globals.l2net_home.Add_Text("Clan members: " + Globals.ClanMembers.ToString(), Globals.Green, TextType.BOT);


                Globals.ClanOnline = 0;

                listView_char_clan.BeginUpdate();
                //listView_char_clan.ListViewItemSorter = null;

                listView_char_clan.Items.Clear();
                for (uint i = 0; i < Globals.ClanMembers; i++)
                {
                    Set_MemberInfo(buff, false);
                }

                //listView_char_clan.ListViewItemSorter = lvwColumnSorter_clan;
                listView_char_clan.EndUpdate();
                update = true;
            }

            if (update)
            {
                label_clan_name.Text = clan_name;
                label_clan_leader.Text = clan_leader;
                label_clan_level.Text = clan_level.ToString();
                label_clan_castle.Text = clan_castle.ToString();
                label_clan_hall.Text = clan_hideout.ToString();
                label_clan_rep.Text = clan_rep.ToString();
                label_clan_war.Text = in_war.ToString();
                label_caln_ally.Text = ally_name;
                label_clan_online.Text = Globals.m_ResourceManager.GetString("col_Online") + ": " + Globals.ClanOnline.ToString() + "/" + Globals.ClanMembers.ToString();

                try
                {
                    if (pictureBox_clan_crest.BackgroundImage != null)
                    {
                        pictureBox_clan_crest.BackgroundImage.Dispose();
                        pictureBox_clan_crest.BackgroundImage = null;
                    }
                    string path = Globals.PATH + "\\crests\\" + clan_crest.ToString() + ".bmp";


                    //Globals.l2net_home.Add_Text("Crest location pre: " + path);
                    pictureBox_clan_crest.BackgroundImage = new System.Drawing.Bitmap(path);
                    //Globals.l2net_home.Add_Text("Crest location: " +path);
                }
                catch (Exception e)
                {
                    pictureBox_clan_crest.BackgroundImage = new System.Drawing.Bitmap(16, 8);
                    Globals.l2net_home.Add_Text("Exception: " + e.Message, Globals.Green, TextType.BOT);
                }
            }
        }