قديم 2020-04-04, 10:48 PM
المشاركة #2  
ElSaher
  • غير متواجد
افتراضي رد: يا رجاله بالله حل يا ليدر
امسح كلاس Clan من عندك وتضيف دا


كود:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using Mr_Panda.Client;
using Mr_Panda.Database;
using Mr_Panda.Interfaces;
using Mr_Panda.Network;
using Mr_Panda.Network.GamePackets;
using Mr_Panda.Game;

namespace 
Mr_Panda
{
    public class 
Clan WriterIPacket
    
{
        private 
Byte[] mData;
        private 
Int32 Position 17;
        private 
UInt32 mLeadermFundmAllyRequest;
        private 
String mNamemInfomAnnouncement;
        private 
Byte mLevelmBPTower;
        public 
Client.GameState client;
        public 
UInt32 WarScore 0;
        public 
bool PoleKeeper false;

        private 
Dictionary<UInt32ClanMembermMembers;
        private 
Dictionary<UInt32ClanmAlliesmEnemies;

        public 
Clan(UInt32 leaderidUInt32 clanidString clannameString leadername)
        {
            
LeaderId leaderid;

            
mMembers = new Dictionary<UInt32ClanMember>();
            
mAllies = new Dictionary<UInt32Clan>();
            
mEnemies = new Dictionary<UInt32Clan>();


            
mData = new byte[141 + (Byte)(clanname.Length leadername.Length) + 8];
            
WriteUInt16((UInt16)(mData.Length 8), 0mData);
            
WriteUInt16((UInt16)13122mData);

            
ID clanid;
            
Name clanname;
        }
        public 
Clan()
        {
            
mData = new byte[141 8];
            
WriteUInt16((UInt16)(mData.Length 8), 0mData);
            
WriteUInt16((UInt16)13122mData);
        }
        public 
UInt32 LeaderId
        
{
            
get { return mLeader; }
            
set mLeader value; }
        }
        public 
Types Type
        
{
            
get { return (Types)BitConverter.ToUInt32(mData4); }
            
set WriteByte((Byte)value4mData); }
        }
        public 
UInt32 ID
        
{
            
get { return BitConverter.ToUInt32(mData8); }
            
set WriteUInt32((UInt32)value8mData); }
        }
        public 
Byte Offset16
        
{
            
get { return mData[16]; }
            
set mData[16] = value; }
        }
        public 
Byte Offset17
        
{
            
get { return mData[17]; }
            
set mData[17] = value; }
        }
        public 
String Offset18String
        
{
            
get { return Program.Encoding.GetString(mData18mData[17]).Trim(new Char[] { '\0' }); }
            
set WriteString(value18mData); }
        }
        public 
String Name
        
{
            
get { return mName; }
            
set mName value; }
        }

        private 
string leaderName;
        public 
bool CalnWar;
        public 
string LeaderName
        
{
            
get
            
{
                return 
leaderName;
            }
            
set
            
{
                
leaderName value;
                
Writer.WriteString(value32mData);
            }
        }
        public 
UInt32 Fund
        
{
            
get { return mFund; }
            
set mFund value; }
        }
        public 
Byte Level
        
{
            
get { return mLevel; }
            
set mLevel value; }
        }
        public 
Byte BPTower
        
{
            
get { return mBPTower; }
            
set mBPTower value; }
        }
        public 
String Announcement
        
{
            
get { return mAnnouncement; }
            
set mAnnouncement value; }
        }
        public 
String Info
        
{
            
get { return mInfo; }
            
set mInfo value; }
        }
        public 
UInt32 AllyRequest
        
{
            
get { return mAllyRequest; }
            
set mAllyRequest value; }
        }

        public 
void Build(GameState cTypes type)
        {
            
this.Type type;
            switch (
type)
            {
                case 
Types.Info:
                    {
                        
ClanMember member;
                        if (
Members.TryGetValue(c.Player.UIDout member))
                        {
                            
Info System.String.Format("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11}"
                                
IDmMembers.Count(), 0FundLevel 1Convert.ToByte(c.Player.ClanRank), 0BPTower000member.Donation);

                            
Offset16 6;

                            
WriteStringWithLength(InfoPositionmData);
                            
Position += Info.Length;
                            
Position++;

                            
WriteStringWithLength(NamePositionmData);
                            
Position += Name.Length;
                            
Position++;

                            
WriteStringWithLength(LeaderNamePositionmData);
                            
Position += LeaderName.Length;
                            
Position++;

                            
string text2 "0 0 0 0 0 0 0";
                            
Writer.WriteStringWithLength(text2PositionmData);
                            
ClanWarArena.ClientWar clientWar;
                            if (
ClanWarArena.GetMyWar(this.IDout clientWar))
                            {
                                
string dominationMap clientWar.DominationMap;
                                
Position += text2.Length;
                                
Position++;
                                
Writer.WriteStringWithLength(dominationMapPositionmData);
                                
string curentMap clientWar.CurentMap;
                                
Position += dominationMap.Length;
                                
Position++;
                                
Writer.WriteStringWithLength(curentMapPositionmData);
                            }
                            
Position 17;
                        }
                        break;
                    }
                case 
Types.MyClan:
                    {
                        
string text "0 0 0 0 0 0 0";
                        
ClanWarArena.ClientWar clientWar;
                        if (
ClanWarArena.GetMyWar(this.IDout clientWar))
                        {
                            
text string.Concat(new object[]{"1 ",
                        
clientWar.OccupationDays," ",
                        
clientWar.Reward," ",
                        
clientWar.NextReward," 0 0 0"});
                        }
                        
this.Offset16 1;
                        
this.Offset17 = (byte)text.Length;
                        
Writer.WriteString(text18this.mData);
                        break;
                    }
            }
        }
        private static 
void UpdateData(Client.GameState clientstring columnobject value)
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                
cmd.Update("clans").Set(columnvalue).Where("identifier"client.Player.ClanId)
                    .
Execute();
        }
        public 
void Save(Client.GameState clientString rowUInt16 value)
        {
            
UpdateData(clientrowvalue);
        }
        public 
void Save(Client.GameState clientString rowByte value)
        {
            
UpdateData(clientrowvalue);
        }
        public 
void Save(Client.GameState clientString rowString value)
        {
            
UpdateData(clientrowvalue);
        }
        public 
void Save(Client.GameState clientString rowUInt32 value)
        {
            
UpdateData(clientrowvalue);
        }
        public 
UInt32 GetClanId(String name)
        {
            
lock (Kernel.Clans)
            {
                foreach (
Clan clans in Kernel.Clans.Values)
                {
                    if (
clans.Name == name)
                        return 
clans.ID;
                }
            }
            return 
0;
        }
        public 
Dictionary<UInt32ClanMemberMembers get { return this.mMembers; } }
        public 
Dictionary<UInt32ClanAllies get { return this.mAllies; } }
        public 
Dictionary<UInt32ClanEnemies get { return this.mEnemies; } }

        public 
void InfoToMembers()
        {
            
GameState mem;
            foreach (
ClanMember member in this.Members.Values)
            {
                if (
Kernel.GamePool.TryGetValue(member.Identifierout mem))
                {
                    
mem.Player.GetClan.Build(memTypes.Info);
                    
mem.Send(mem.Player.GetClan.ToArray());
                    
mem.Send(new ClanMembers(mem.Player.GetClan).ToArray());

                }
            }
        }
        public 
void SendMessage(IPacket packet)
        {
            
GameState mem;
            foreach (
ClanMember member in this.Members.Values)
            {
                if (
Kernel.GamePool.TryGetValue(member.Identifierout mem))
                    
mem.Send(packet);
            }
        }
        public static 
void nobmas(Client.GameState client)
        {
            
Kernel.SendWorldMessage(new Message("Congratulation! " client.Player.Name "Donation To " client.NobilityInformation.Rank " in Nobility Rank!"System.Drawing.Color.White2011), Program.Values);
        }
        public static 
UInt32 NextClanId
        
{
            
get
            
{
                
UInt32 start 600;
                while (
Kernel.Clans.ContainsKey(start))
                    
start++;
                return 
start;
            }
        }
        public static 
Boolean ValidName(String name)
        {
            if (
name.Length || name.Length 35) return false;
            foreach (
Clan clans in Kernel.Clans.Values)
                if (
clans.Name == name)
                    return 
false;
            return 
true;
        }
        public 
void AddRelation(UInt32 RelativeClanRelations.RelationTypes type)
        {
            try
            {
                
using (var cmd = new MySqlCommand(MySqlCommandType.INSERT).Insert("clanrelation"))
                    
cmd.Insert("id"ID).Insert("clanid"ID).Insert("associatedid"Relative).Insert("type", (byte)type).Execute();
            }
            catch
            {
            }
        }
        public 
void DeleteRelation(UInt32 RelativeClanRelations.RelationTypes type)
        {
            try
            {
                
using (var cmd = new MySqlCommand(MySqlCommandType.DELETE))
                    
cmd.Delete("clanrelation""clanid"ID).And("associatedid"Relative)
                        .And(
"type", (byte)type).Execute();
            }
            catch
            {
            }
        }
        public 
void Join(GameState c)
        {
            
c.Player.ClanId ID;
            
c.Player.ClanRank Ranks.Member;
            
c.Player.ClanName Name;
            
Database.EntityTable.UpdateClanID(c);
            
Database.EntityTable.UpdateClanRank(c);

            
Members.Add(c.Player.UID, new ClanMember()
            {
                Class = 
c.Player.Class,
                
Donation 0,
                
Identifier c.Player.UID,
                
Level c.Player.Level,
                
Name c.Player.Name,
                
Rank c.Player.ClanRank
            
});

            
Build(cTypes.Info);
            
c.Send(this);

            
c.Player.Teleport(c.Player.MapIDc.Player.Xc.Player.Y);

            
SendMessage(new Message(System.String.Format("{0} Has Joined the Clan!"c.Player.Name), Color.RedMessage.Clan));
        }
        public static 
void CreateClan(GameState cString cname)
        {
            
UInt32 id NextClanId;
            
Clan clan = new Clan(c.Player.UIDidcnamec.Player.Name);
            
clan.Fund 250000;
            
clan.ID id;
            
clan.BPTower 0;
            
clan.Level 1;
            
clan.Name cname;
            
clan.LeaderName c.Player.Name;

            
clan.Members.Add(c.Player.UID, new ClanMember()
            {
                Class = 
c.Player.Class,
                
Donation 250000,
                
Identifier c.Player.UID,
                
Level c.Player.Level,
                
Name c.Player.Name,
                
Rank Ranks.ClanLeader
            
});

            
Kernel.Clans.Add(idclan);

            
Kernel.SendWorldMessage(new Message(System.String.Format("{0} has succesfully set up a new Clan {1}"c.Player.Namecname), Color.Red,
                    
Message.TopLeft));

            
using (var cmd = new MySqlCommand(MySqlCommandType.INSERT))
                
cmd.Insert("clans").Insert("identifier"id)
                    .
Insert("leaderid"clan.LeaderId).Insert("name"clan.Name)
                    .
Insert("fund"clan.Fund).Insert("announcement""")
                    .
Insert("BPTower"clan.BPTower).Insert("Level"clan.Level)
                    .
Insert("LeaderName"c.Player.Name).Insert("polekeeper"0).Execute();

            
c.Player.ClanId id;
            
c.Player.ClanRank Ranks.ClanLeader;
            
Database.EntityTable.UpdateClanID(c);
            
Database.EntityTable.UpdateClanRank(c);
            
c.Player.ClanName cname;
            
clan.Build(cTypes.Info);
            
c.Send(clan);
            
c.SendScreen(c.Player.SpawnPackettrue);
        }
        public static 
void LoadClans()
        {
            
Dictionary<uintDictionary<uintClanMember>> dict = new Dictionary<uintDictionary<uintClanMember>>();

            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("entities").Where("clanid"0true))
            
using (var reader cmd.CreateReader())
            {
                while (
reader.Read())
                {
                    
uint clanId reader.ReadUInt32("clanid");
                    
ClanMember mem = new ClanMember()
                    {
                        
UID reader.ReadUInt32("Uid"),
                        
Identifier reader.ReadUInt32("Uid"),
                        Class = 
reader.ReadByte("Class"),
                        
Donation reader.ReadUInt32("ClanDonation"),
                        
Level reader.ReadByte("Level"),
                        
Name reader.ReadString("Name"),
                        
Rank = (Ranks)reader.ReadByte("ClanRank"),
                    };
                    if (!
dict.ContainsKey(clanId)) dict.Add(clanId, new Dictionary<uintClanMember>());
                    
dict[clanId].Add(mem.UIDmem);
                }
            }
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("clans"))
            
using (var reader cmd.CreateReader())
            {
                while (
reader.Read())
                {
                    
UInt32 HeroId reader.ReadUInt32("LeaderId");
                    
Clan c = new Clan(HeroIdreader.ReadUInt32("Identifier"), reader.ReadString("Name"), reader.ReadString("LeaderName"));
                    {
                        
c.Announcement reader.ReadString("Announcement");
                        
c.BPTower reader.ReadByte("BPTower");
                        
c.ID reader.ReadUInt32("Identifier");
                        
c.Fund reader.ReadUInt32("Fund");
                        
c.LeaderId reader.ReadUInt32("LeaderId");
                        
c.Level reader.ReadByte("Level");
                        
c.LeaderName reader.ReadString("LeaderName");
                        
c.PoleKeeper reader.ReadBoolean("PoleKeeper");
                    }
                    
Kernel.Clans.Add(c.IDc);
                    if (
dict.ContainsKey(c.ID))
                        
c.mMembers dict[c.ID];
                    else
                        
c.mMembers = new Dictionary<uintClanMember>();
                }
            }
            foreach (
Clan c in Kernel.Clans.Values)
            {
                
c.LoadAssociates();
            }
        }
        public static 
void DisbandClan(GameState c)
        {
            
byte[] Packet = new byte[90];
            
Writer.WriteUInt16(820Packet);
            
Writer.WriteUInt16(13122Packet);
            
Writer.WriteUInt32(234Packet);
            
Writer.WriteUInt32(c.Player.UID8Packet);
            if (
c.Team != null)
                
c.Team.GetClanShareBp(c);
            
Database.EntityTable.RemoveClan(c);
            
using (var cmd = new MySqlCommand(MySqlCommandType.DELETE))
                
cmd.Delete("clans""leaderid"c.Player.UID).Execute();

            foreach (var 
h in c.Player.GetClan.Members.Values)
            {
                var 
hero Program.Values.SingleOrDefault(=> x.Player.UID == h.Identifier);
                if (
hero != null)
                {
                    
hero.Player.ClanRank Clan.Ranks.None;
                    
hero.Player.ClanName "";
                    
hero.Player.ClanId 0;
                    
hero.Send(Packet);
                    
hero.SendScreenSpawn(hero.Playertrue);
                }
            }
            
Kernel.Clans.Remove(c.Player.ClanId);
        }
        public static 
void SaveClan(Clan clan)
        {
            
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
            
cmd.Update("Clans").Set("Fund"clan.Fund).Set("Level"clan.Level)
                .
Set("Bulletin"clan.Announcement).Set("Leader"clan.leaderName).Where("ClanID"clan.ID).Execute();
        }
        public static 
void TransferClan(string name)
        {
            
MySqlCommand cmd3 = new MySqlCommand(MySqlCommandType.UPDATE);
            
cmd3.Update("entities")
                .
Set("ClanRank"100).Where("Name"name).Execute();
        }
        private 
void LoadAssociates()
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("clanrelation").Where("clanid"this.ID))
            
using (var reader cmd.CreateReader())
            {
                while (
reader.Read())
                {
                    
UInt32 AssociateId reader.ReadUInt32("AssociatedId");
                    
ClanRelations.RelationTypes Type = (ClanRelations.RelationTypes)(reader.ReadUInt32("Type"));
                    
Clan c;
                    if (
Kernel.Clans.TryGetValue(AssociateIdout c))
                    {
                        if (
Type == ClanRelations.RelationTypes.Allies)
                            
this.Allies.Add(AssociateIdc);
                        else
                            
this.Enemies.Add(AssociateIdc);
                    }
                }
            }
        }
        public 
enum Types byte
        
{
            
Info 1,
            
Members 4,
            
Recruit 9,
            
AcceptRecruit 10,
            
Join 11,
            
AcceptJoinRequest 12,
            
AddEnemy 14,
            
DeleteEnemy 15,
            
AddAlly 17,
            
AcceptAlliance 18,
            
DeleteAlly 20,
            
TransferLeader 21,
            
Kick 22,
            
Quit 23,
            
Announce 24,
            
SetAnnouncement 25,
            
Dedicate 26,
            
MyClan 29
        
}
        public 
enum Ranks ushort
        
{
            
ClanLeader 100,
            
Spouse 11,
            
Member 10,
            
None 0
        
}
        public 
void Send(GameState client) { client.Send(mData); }
        public 
byte[] ToArray() { return mData; }
        public 
void Deserialize(byte[] buffer) { mData buffer; }

        public 
void SendClanShareBp(uint leaderUIDuint BpShareClient.GameState client)
        {
            
Network.GamePackets.Update update = new Network.GamePackets.Update(true) { UID client.Player.UID };
            
update.Append(Network.GamePackets.Update.ClanShareBpleaderUID);
            
//update.Append4(Network.GamePackets.Update.ClanShareBp, BpShare);
            
client.Send(update.ToArray());

        }
    }



قديم 2020-04-04, 10:54 PM
المشاركة #3  
abdocoder
  • غير متواجد
افتراضي رد: يا رجاله بالله حل يا ليدر
انا عندي كلاس كلان 1 و كلاس كلان 2 احطو في انهي كلاس

قديم 2020-04-04, 10:58 PM
المشاركة #4  
midoazoz
  • غير متواجد
افتراضي رد: يا رجاله بالله حل يا ليدر
يا عم متمسح حرب الكلان كلها وضيفها من اول وجديد من سورس شغال فيه ومفيش اكتر منهم بعدين انت بتقول في كلاس 1 و 2 يعني معكوك فيها انت امسحهم وضيفها من الاول كلها الموضوع سهل اووي

قديم 2020-04-04, 11:00 PM
المشاركة #5  
ahmedfathy
  • غير متواجد
افتراضي رد: يا رجاله بالله حل يا ليدر
كلمني فيس بوك الحل سهل جدآ وانا همسحلك الكلان خالص وضفهولك من الاول علي نضيف عشان 100 في ال 100 في مشاكل تاني عندك في الحرب نفسها


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



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

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

المواضيع المتشابهه للموضوع: يا رجاله بالله حل يا ليدر
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
جرمنت ريال مدير وبرشلونه محمد ياسر تطوير سيرفرات كونكر 18 2024-09-30 08:18 AM
يا رجاله بالله عندي مشكله abdocoder مشكلات السيرفيرات كونكر الشخصيه 4 2020-04-21 11:28 AM
مشكلة فى توب الجيلد ليدر والدبيوتى ليدر ViORX مشكلات السيرفيرات كونكر الشخصيه 6 2019-09-23 06:43 AM
كوتسة لى الجلد ليدر وى الدبتى ليدر Mero تطوير سيرفرات كونكر 1 2019-06-25 10:39 PM


الساعة الآن 04:01 AM

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