الموضوع: طلب
عرض مشاركة واحدة
قديم 2020-04-01, 03:42 PM
المشاركة 11
ElSaher
.:: مشرف قسم المشاكل ::.
  • متواجد  الان
افتراضي رد: طلب
ضيف دي تحت
public void GetAll(Client.GameState client)
بعد دي

الاكواد دي ضيف

كود:
public void AddTitle(Client.GameState clientshort _typeshort _idbool equipped falseint TimeInSeconds 0)
        {
            if (
StorageManager.Wing<bool>(_type_id))
            {
                if (!
client.Player.Wings.ContainsValue((uint)_id))
                    
client.Player.Wings.Add((uint)_type, (uint)_id);
                else return;
            }
            else
            {
                if (!
client.Player.WTitles.ContainsValue((uint)_id))
                    
client.Player.WTitles.Add((uint)_type, (uint)_id);
                else return;
            }
            
client.Player.UTitlePoints += StorageManager.GetTitlePoints(_type_id);
            var 
pkt = new TitleStorageProto()
            {
                
ActionId Action.Update,
                
Points client.Player.UTitlePoints,
                
Value = new TitleValue()
                {
                    
Type _type,
                    
Id _id,
                    
Equipped equipped,
                    
Time TimeInSeconds,
                }
            };

            
client.Send(FinalizeProtoBuf(pkt));
            if (
equipped)
            {
                if (
StorageManager.Wing<bool>(_type_id))
                {
                    
client.Player.EquippedWing StorageManager.Wing<int>(_type_id);
                    
client.Player.NowEquippedWing.Clear();
                    
client.Player.NowEquippedWing.Add(_type "~" _id);
                }
                else if (
StorageManager.Title<bool>(_type_id))
                {
                    
client.Player.EquippedTitle StorageManager.Title<int>(_type_id);
                    
client.Player.NowEquippedTitle.Clear();
                    
client.Player.NowEquippedTitle.Add(_type "~" _id);
                }
            }
        } 

تحتو ضيف

كود:
        public void RemoveTitle(Client.GameState clientshort _typeshort _idbool equipped false)
        {
            if (
StorageManager.Wing<bool>(_type_id))
            {
                if (
client.Player.Wings.ContainsValue((uint)_id))
                {
                    
client.Player.Wings.Remove((uint)_type);
                    if (
client.Player.EquippedWing == StorageManager.Wing<int>(_type_id))
                    {
                        
client.Player.EquippedWing 0;
                        
client.Player.NowEquippedWing.Clear();

                        var 
pkt = new TitleStorageProto()
                        {
                            
ActionId Action.Unequip,
                            
Id _id,
                            
Type _type,
                            
Points client.Player.UTitlePoints,
                            
Value = new TitleValue()
                            {
                                
Type _type,
                                
Id _id,
                                
Equipped false
                            
}

                        };
                        
client.Send(FinalizeProtoBuf(pkt));

                    }
                    
client.Player.UTitlePoints -= StorageManager.GetTitlePoints(_type_id);
                    var 
pkt2 = new TitleStorageProto()
                    {
                        
ActionId Action.RemoveTitle,
                        
Id _id,
                        
Type _type,
                        
Points client.Player.UTitlePoints,
                        
Value = new TitleValue()
                        {
                            
Type _type,
                            
Id _id,
                            
Equipped false
                        
}
                    };
                    
client.Send(FinalizeProtoBuf(pkt2));
                }
                else return;
            }
            else
            {
                if (
client.Player.WTitles.ContainsValue((uint)_id))
                {
                    
client.Player.WTitles.Remove((uint)_type);
                    if (
client.Player.EquippedTitle == StorageManager.Title<int>(_type_id))
                    {
                        
client.Player.EquippedTitle 0;
                        
client.Player.NowEquippedTitle.Clear();
                        var 
pkt = new TitleStorageProto()
                        {
                            
ActionId Action.Unequip,
                            
Id _id,
                            
Type _type,
                            
Points client.Player.UTitlePoints,
                            
Value = new TitleValue()
                            {
                                
Type _type,
                                
Id _id,
                                
Equipped false
                            
}
                        };
                        
client.Send(FinalizeProtoBuf(pkt));
                    }
                    
client.Player.UTitlePoints -= StorageManager.GetTitlePoints(_type_id);
                    var 
pkt2 = new TitleStorageProto()
                    {
                        
ActionId Action.RemoveTitle,
                        
Id _id,
                        
Type _type,
                        
Points client.Player.UTitlePoints,
                        
Value = new TitleValue()
                        {
                            
Type _type,
                            
Id _id,
                            
Equipped false
                        
}
                    };
                    
client.Send(FinalizeProtoBuf(pkt2));
                }
                else return;
            }
        } 

تحتو ضيف

كود:
  public byte[] FinalizeProtoBuf(TitleStorageProto titleStorageProto)
        {
            
using (var memoryStream = new MemoryStream())
            {
                
Serializer.SerializeWithLengthPrefix(memoryStreamtitleStorageProtoPrefixStyle.Fixed32);
                var 
pkt = new byte[memoryStream.Length];
                
memoryStream.ToArray().CopyTo(pkt0);
                
Writer.Write((ushort)memoryStream.Length0pkt);
                
Writer.Write((ushort)33012pkt);

                return 
pkt;
            }
        }


        public 
TitleStorageProto Info