قديم 2020-04-01, 02:28 PM
المشاركة #2  
medo2020
  • غير متواجد
افتراضي رد: npc open to full TitleStorage
مش بيفتح حاجه ومش شغال بيظ

قديم 2020-04-02, 05:30 PM
المشاركة #3  
ElSaher
  • غير متواجد
افتراضي رد: npc open to full TitleStorage
نسيت حاجا يا جدعان ياريت حد يعدل علي الاضافت

هتخوش علي كلاس

ضيف دول في اخر الكلاس Wardrobe.cs

كود:
        public void Handle(Client.GameState client)
        {
            switch (
Info.ActionId)
            {
                case 
Action.Unequip:
                    {
                        if (
StorageManager.Wing<bool>(Info.TypeInfo.Id))
                        {
                            
client.Player.EquippedWing 0;
                            
client.Player.NowEquippedWing.Clear();
                        }
                        else if (
StorageManager.Title<bool>(Info.TypeInfo.Id))
                        {
                            
client.Player.EquippedTitle 0;
                            
client.Player.NowEquippedTitle.Clear();
                        }
                        
client.Send(FinalizeProtoBuf(Info));
                        break;
                    }
                case 
Action.Equip:
                    {
                        if (
client.Player.UTitlePoints StorageManager.GetTitlePoints((short)Info.Type, (short)Info.Id))
                            break;
                        if (
StorageManager.Wing<bool>(Info.TypeInfo.Id))
                        {
                            
client.Player.EquippedWing StorageManager.Wing<int>(Info.TypeInfo.Id);
                            
client.Player.NowEquippedWing.Clear();
                            
client.Player.NowEquippedWing.Add(Info.Type "~" Info.Id);
                        }
                        else if (
StorageManager.Title<bool>(Info.TypeInfo.Id))
                        {
                            
client.Player.EquippedTitle StorageManager.Title<int>(Info.TypeInfo.Id);
                            
client.Player.NowEquippedTitle.Clear();
                            
client.Player.NowEquippedTitle.Add(Info.Type "~" Info.Id);
                        }

                        
Info = new TitleStorageProto()
                        {
                            
ActionId Action.Equip,
                            
Points client.Player.UTitlePoints,
                            
Type Info.Type,
                            
Id Info.Id,
                        };

                        
client.Send(FinalizeProtoBuf(Info));
                        break;
                    }
            }
            new 
TitleStorage().CheckTitles(client);
        }
        public 
void GetAll(Client.GameState client)
        {
            foreach (var 
title in Database.WardrobeTable.Titles.Values)
            {
                
AddTitle(client, (short)title.Type, (short)title.IDfalse);
            }
            
client.Player.haveallTitles true;
        }
        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;
        [
Flags]
        public 
enum Action int
        
{
            
Update 0,
            
UseTitle 1,
            
RemoveTitle 3,
            
Equip 4,
            
Unequip 5,
        }
    }
    [
ProtoContract]
    public class 
TitleStorageProto
    
{
        [
ProtoMember(1IsRequired true)]
        public 
TitleStorage.Action ActionId;
        [
ProtoMember(2IsRequired true)]
        public 
int Points;
        [
ProtoMember(3IsRequired true)]
        public 
int Type;
        [
ProtoMember(4IsRequired true)]
        public 
int Id;
        [
ProtoMember(5IsRequired true)]
        public 
TitleValue Value;
    }
    [
ProtoContract]
    public class 
TitleValue
    
{
        [
ProtoMember(1IsRequired true)]
        public 
int Type;
        [
ProtoMember(2IsRequired true)]
        public 
int Id;
        [
ProtoMember(3IsRequired true)]
        public 
bool Equipped;
        [
ProtoMember(4IsRequired true)]
        public 
int Time;
    }




قديم 2020-04-02, 06:50 PM
المشاركة #4  
medo2020
  • غير متواجد
افتراضي رد: npc open to full TitleStorage
فين اضيفهم تحت ايه


العلامات المرجعية



الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1)
 

الانتقال السريع

المواضيع المتشابهه للموضوع: npc open to full TitleStorage
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
Poker Open Source Mostafa Shalby تطوير سيرفرات كونكر 49 2024-10-29 06:32 AM
Npc Open All New Wing~Titel Users تطوير سيرفرات كونكر 6 2020-04-23 09:29 AM
NewServer Open 21/4/2020 abdo22 اعلانات السيرفيرات الشخصية 0 2020-04-21 07:59 PM
Big Monsters full system Tefa تطوير سيرفرات كونكر 6 2019-12-21 05:21 PM
Demon Box Full Add Mero تطوير سيرفرات كونكر 0 2019-04-28 02:33 PM


الساعة الآن 05:22 PM

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.