عرض مشاركة واحدة
احصائياتى

الردود
6

المشاهدات
5556
 
Hassan Emprator

Hassan Emprator is on a distinguished road

    غير متواجد

المشاركات
1,372

+التقييم
0.62

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

الاقامة

نظام التشغيل

رقم العضوية
30
2019-12-09, 09:12 PM
المشاركة 1 
#1  
افتراضي اضافه حرب ClanWar لمن يعاني في مشاكل عنده

اولا كدا سيبك من اي اضافه عندك بعيد عن كلاس UnionWar دي اضافه مظبوطه وهنضيفها كامله انشاء الله


اعمل كلاس وسميه ClanWar2

وضيف فيه


كود:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EmpratorServer.Network.GamePackets;
using EmpratorServer.Database;

namespace 
EmpratorServer.Game
{
    public class 
ClanWar
    
{
        public static 
SobNpcSpawn Pole;
        public static 
SafeDictionary<uintClanScores = new SafeDictionary<uintClan>(100);
        public static 
bool IsWar falseFirstRound false;
        public static 
Time32 ScoreSendStampLastWin;
        public static 
Clan PoleKeeperCurrentTopLeader;
        private static 
bool changed false;
        private static 
string[] scoreMessages;
        public static 
DateTime StartTime;
        public static 
bool Claim
        
{
            
get { return Program.Vars["cwclaim"]; }
            
set Program.Vars["cwclaim"] = value; }
        }
        public static 
uint KeeperID
        
{
            
get { return Program.Vars["cwkeeperid"]; }
            
set Program.Vars["cwkeeperid"] = value; }
        }
        public static 
void Initiate()
        {
            var 
Map Kernel.Maps[1509];
            
Pole = (SobNpcSpawn)Map.Npcs[812];
        }
        public static 
void Start()
        {
            
Scores = new SafeDictionary<uintClan>(100);
            
StartTime DateTime.Now;
            
Kernel.SendWorldMessage(new Message("Clan war has began!"System.Drawing.Color.RedMessage.Center), Program.Values);
            
FirstRound true;
            foreach (
Clan clan in Kernel.Clans.Values)
            {
                
clan.WarScore 0;
            }
            
Claim false;
            
IsWar true;
        }

        public static 
void Reset()
        {
            
Scores = new SafeDictionary<uintClan>(100);
            
Pole.Hitpoints Pole.MaxHitpoints;

            foreach (
Clan clan in Kernel.Clans.Values)
            {
                
clan.WarScore 0;
            }

            
IsWar true;
        }

        public static 
void FinishRound()
        {
            
LastWin Time32.Now;

            
FirstRound false;
            
SortScores(out PoleKeeper);
            if (
PoleKeeper != null)
            {
                
KeeperID PoleKeeper.ID;
                
Kernel.SendWorldMessage(new Message("The Clan, " PoleKeeper.Name ", owned by " PoleKeeper.LeaderName " has won this Clan war round!"System.Drawing.Color.RedMessage.Center), Program.Values);

                
Pole.Name PoleKeeper.Name;
            }
            
Pole.Hitpoints Pole.MaxHitpoints;
            
Kernel.SendWorldMessage(PoleProgram.Values, (ushort)1509);
            
Reset();
        }

        public static 
void End()
        {
            if (
PoleKeeper != null)
            {
                
Kernel.SendWorldMessage(new Message("The clan, " PoleKeeper.Name ", owned by " PoleKeeper.LeaderName " has won " ServerRates.Clan " cps!---Clan war has ended!"System.Drawing.Color.WhiteMessage.Center), Program.Values);

                
PoleKeeper.PoleKeeper true;
            }
            else
            {
                
Kernel.SendWorldMessage(new Message("Clan war has ended and there was no winner!"System.Drawing.Color.RedMessage.Center), Program.Values);

            }
            
Claim true;
            
IsWar false;
            
UpdatePole(Pole);
        }

        public static 
void AddScore(uint addScoreClan clan)
        {
            if (
clan != null)
            {
                
clan.WarScore += addScore;
                
changed true;
                if (!
Scores.ContainsKey(clan.ID))
                    
Scores.Add(clan.IDclan);
                if ((int)
Pole.Hitpoints <= 0)
                {
                    
FinishRound();

                    return;
                }
            }
        }

        public static 
void SendScores()
        {
            if (
scoreMessages == null)
                
scoreMessages = new string[0];
            if (
Scores.Count == 0)
                return;
            if (
changed)
                
SortScores(out CurrentTopLeader);

            for (
int c 0scoreMessages.Lengthc++)
            {
                
Message msg = new Message(scoreMessages[c], System.Drawing.Color.Red== Message.FirstRightCorner Message.ContinueRightCorner);
                
Kernel.SendWorldMessage(msgProgram.Values, (ushort)1509);
            }
        }

        private static 
void SortScores(out Clan winner)
        {
            
winner null;
            List<
stringret = new List<string>();
            
int Place 0;
            foreach (
Clan clan in Scores.Values.OrderByDescending((p) => p.WarScore))
            {
                if (
Place == 0)
                    
winner clan;
                
string str "No  " + (Place 1).ToString() + ": " clan.Name "(" clan.WarScore ")";
                
ret.Add(str);
                
Place++;
                if (
Place == 4)
                    break;
            }

            
changed false;
            
scoreMessages ret.ToArray();
        }

        private static 
void UpdatePole(SobNpcSpawn pole)
        {
            new 
Database.MySqlCommand(EmpratorServer.Database.MySqlCommandType.UPDATE)
            .
Update("sobnpcs").Set("name"pole.Name).Set("life"Pole.Hitpoints).Where("id"pole.UID).Execute();
        }
    }


كلاس Handel

ضيف

تخت


كود:
 if (attacker.MapID == 2075



كود:
            if (attacker.MapID == 1509)
            {
                if (
attacked.UID == 812)
                {
                    
Clan clan attacker.GetClan;
                    if (
Game.ClanWar.PoleKeeper == clan)
                        return;
                    if (
attacked.Hitpoints <= damage)
                        
attacked.Hitpoints 0;
                    
Game.ClanWar.AddScore(damageclan);
                }
            } 

ابحث عن

كود بلغة HTML:
if (attacker.MapID == 2075)
ضيف


كود:
            if (attacker.MapID == 1509)
            {
                if (
attacker.ClanId == || !Game.ClanWar.IsWar)
                {
                    if (
attacked.UID == 812)
                    {
                        return 
false;
                    }
                }
                if (
Game.ClanWar.PoleKeeper != null)
                {
                    if (
Game.ClanWar.PoleKeeper == attacker.GetClan)
                    {
                        if (
attacked.UID == 812)
                        {
                            return 
false;
                        }
                    }
                }
            } 


الانبي سي


كود:
#region CLANWAR
                
case 48116:
                    {
                        switch (
npcRequest.OptionID)
                        {
                            case 
0:
                                {
                                    
dialog.Text("Hello there. Do you want to Join The ClanWar?.");
                                    
dialog.Option("Yes Please."1);
                                    
dialog.Option("Claim Prize."2);
                                    
dialog.Option("Just Passing By!"255);
                                    
dialog.Send();
                                    break;
                                }
                            case 
1:
                                {
                                    if (
ClanWar.IsWar)
                                    {
                                        
client.Entity.Teleport(150982118);
                                        
client.Entity.PKMode Game.Enums.PKMode.PK;
                                        
client.Send(new Data(true) { UID client.Entity.UIDID Data.ChangePKModedwParam = (uint)client.Entity.PKMode });
                                    }
                                    else
                                    {
                                        
dialog.Text("The War Has Not Started Start At [8.00] And [20.00]");
                                        
dialog.Option("Aww ok!"255);
                                        
dialog.Send();
                                    }
                                    break;
                                }
                            case 
2:
                                {
                                    if (
ClanWar.KeeperID != && !ClanWar.IsWar && ClanWar.Claim && client.Entity.ClanId == ClanWar.KeeperID && client.Entity.ClanRank == Clan.Ranks.ClanLeader)
                                    {

                                        
Program.AddWarLog("ClanWar"" . "client.Entity.Name);
                                        
ClanWar.Claim false;
                                        
ClanWar.KeeperID 0;
                                        
client.Entity.ConquerPoints += ServerRates.Clan;

                                        
client.Entity.killerpoints += 100;
                                        
client.Entity.AddTopStatus(Update.Flags2.Top8Archer2DateTime.Now.AddDays(1));
                                        
EmpratorServer.Kernel.SendWorldMessage(new Message("Congratulations! " client.Entity.Name " Leader of " client.Entity.ClanName " The winner Clan has Claimed Clan War Prize " ServerRates.Clan " cps + 100 Vip point's !"System.Drawing.Color.WhiteMessage.TopLeft), Program.Values);
                                    }
                                    else
                                    {
                                        
dialog.Text("Sorry you dont have Any Prize to claim only CL of the winner CLAN can claim Prize After CW");
                                        
dialog.Option("Ahh."255);
                                        
dialog.Send();
                                    }

                                    break;
                                }
                        }
                        break;
                    }
                case 
4482115:
                    {
                        switch (
npcRequest.OptionID)
                        {
                            case 
0:
                                {
                                    
dialog.Text("Hello there. Do you want to Teleport To Twincity.");
                                    
dialog.Option(" Send Me There. "1);
                                    
dialog.Option("Just Passing By!"255);
                                    
dialog.Send();
                                    break;
                                }
                            case 
1:
                                {
                                    
client.Entity.Teleport(1002300266);
                                    break;
                                }
                        }
                        break;
                    }
                
#endregion 

بعدين سيرش عا


كود:
public static readonly System.Collections.Generic.List<ushortPKFreeMaps = new System.Collections.Generic.List<ushort>() 


وضيف


كود:
1509

ودا الانبي سي بتاع الخروج

وابححث عن


كود:
public class Start 

وضيف


كود:
public static bool ClanWar
            
{
                
get
                
{
                    return 
now.Hour == 14 || now.Hour == 2;
                }
            } 

ولو جالك ايرور في GetClan

ضيف في Entity


كود:
public Clan GetClan
        
{
            
get
            
{
                
Clan cl;
                
Kernel.Clans.TryGetValue(ClanIdout cl);
                return 
cl;
            }
        }
        
string clan ""

ودا الاوتو انفنت


كود:
#region Clan War
                
if ((Now64.Hour == 20 || Now64.Hour == 8) && Now64.Minute == 00 && Now64.Second == && !ClanWar.IsWar)
                {
                    
Game.ClanWar.Start();
                    
ClanWarAI false;
                    if (
Now64.Hour != 8)
                    {
                        
ClanWarAI Now64.Hour != 8;
                        foreach (var 
client in Program.Values)
                            if (
client.Entity.GuildID != 0)
                                
client.MessageBox("ClanWar Has Begun! Would You Like To Join This War ...?",
                                    
=> { p.Entity.Teleport(1002284146); }, null);
                    }
                }
                if (
Now64.Hour == && Now64.Minute == 10 && !ClanWarAI)
                {
                    
ClanWarAI true;
                    foreach (var 
client in Program.Values)
                        if (
client.Entity.GuildID != 0)
                            
client.MessageBox("ClanWar Has Begun! Would You Like To Join This War ...?",
                                
=> { p.Entity.Teleport(1002284146); }, null);
                }
                if ((
Now64.Hour == 21 || Now64.Hour == 9) && Now64.Minute == 00 && ClanWar.IsWar)
                {
                    
Game.ClanWar.End();
                }
                if (
Game.ClanWar.IsWar)
                {
                    if (
Time32.Now Game.ClanWar.ScoreSendStamp.AddSeconds(3))
                    {
                        
Game.ClanWar.ScoreSendStamp Time32.Now;
                        
Game.ClanWar.SendScores();
                    }
                
            }
            
#endregion 



وحمل الملاف دا في bin/debug/database



كود:
https://up.top4top.net/downloadf-1438rax941-rar.html 

وبكدا لااضافه كامله انشاء الله والسلام عليكم ورحمه الله