احصائياتى

الردود
3

المشاهدات
415
 
ElSaher
.:: مشرف اقسام كونكر ::.

المشاركات
3,131

+التقييم
1.16

تاريخ التسجيل
Jun 2019

الاقامة
الزقازيق

نظام التشغيل
ويندوز 0

رقم العضوية
279
2020-04-01, 12:59 PM
المشاركة 1
2020-04-01, 12:59 PM
المشاركة 1
افتراضي npc open to full TitleStorage
اضافت npc علي السريع كدا

الانبي سي دا بيفتحلك كل الاشكال الي عندك في السورس تيتل وا ونج


كود:
#region  Titly by elsaher
                    
case 17526:
                        {
                            switch (
npcRequest.OptionID)
                            {
                                case 
0:
                                    {
                                        
dialog.Text("Hello " + client.Player.Name + ", How are you ? I am the manager of the new titles / wings");
                                        
dialog.Text("Do you want to buy wings / titles For free?");
                                        
dialog.Option("All Wing&Titel", 1);
                                        break;
                                    }
                                case 
1:
                                    {
                                        new 
TitleStorage().GetAll(client);
                                        break;
                                    }
                            }
                            break;
                        }
                    
#endregion 



قديم 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.Type, Info.Id))
                        {
                            
client.Player.EquippedWing = 0;
                            
client.Player.NowEquippedWing.Clear();
                        }
                        else if (
StorageManager.Title<bool>(Info.Type, Info.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.Type, Info.Id))
                        {
                            
client.Player.EquippedWing = StorageManager.Wing<int>(Info.Type, Info.Id);
                            
client.Player.NowEquippedWing.Clear();
                            
client.Player.NowEquippedWing.Add(Info.Type + "~" + Info.Id);
                        }
                        else if (
StorageManager.Title<bool>(Info.Type, Info.Id))
                        {
                            
client.Player.EquippedTitle = StorageManager.Title<int>(Info.Type, Info.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.ID, false);
            }
            
client.Player.haveallTitles = true;
        }
        public 
void AddTitle(Client.GameState client, short _type, short _id, bool equipped = false, int 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 client, short _type, short _id, bool 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(memoryStream, titleStorageProto, PrefixStyle.Fixed32);
                var 
pkt = new byte[8 + memoryStream.Length];
                
memoryStream.ToArray().CopyTo(pkt, 0);
                
Writer.Write((ushort)memoryStream.Length, 0, pkt);
                
Writer.Write((ushort)3301, 2, pkt);

                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(1, IsRequired = true)]
        public 
TitleStorage.Action ActionId;
        [
ProtoMember(2, IsRequired = true)]
        public 
int Points;
        [
ProtoMember(3, IsRequired = true)]
        public 
int Type;
        [
ProtoMember(4, IsRequired = true)]
        public 
int Id;
        [
ProtoMember(5, IsRequired = true)]
        public 
TitleValue Value;
    }
    [
ProtoContract]
    public class 
TitleValue
    
{
        [
ProtoMember(1, IsRequired = true)]
        public 
int Type;
        [
ProtoMember(2, IsRequired = true)]
        public 
int Id;
        [
ProtoMember(3, IsRequired = true)]
        public 
bool Equipped;
        [
ProtoMember(4, IsRequired = 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
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
NPC Full Onlen point Mr~Rayzo تطوير سيرفرات كونكر 8 2021-01-23 08:02 PM
Poker Open Source Mostafa Shalby تطوير سيرفرات كونكر 25 2021-01-02 04:19 PM
سيستم Epic Quests Full Like TQ khaledxodia تطوير سيرفرات كونكر 8 2020-03-24 01:13 AM
Big Monsters full system Rider تطوير سيرفرات كونكر 6 2019-12-21 05:21 PM
Demon Box Full Add Mero تطوير سيرفرات كونكر 0 2019-04-28 02:33 PM


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