منتدي اكواد

منتدي اكواد (https://code.vpscairo.com/index.php)
-   تطوير سيرفرات كونكر (https://code.vpscairo.com/forumdisplay.php?f=11)
-   -   اضافة كوسته عمود جزير الطيور (https://code.vpscairo.com/showthread.php?t=157)

محمد ياسر 2019-04-24 08:31 AM

اضافة كوسته عمود جزير الطيور
 

الموضوع طويل شوية ركز عشان دى الاضافة من الاول خالص من الزيرو زي ما بيقولوا ,
..
هي مش موجودة فكل السورسات ,
عشان كدة انا سحبتها من عندى وبنزلها ,

1-الشرح ,
هيا زي الوار بالظبط ..
بس بتكون فماب زي البرد بالظبط بيطلع عمود ,
وبيجيلك اوتو انفيت فالمعاد الخاص بيها ,
..

2- الاضافة ,
أولا أنت هتعمل كلاس جديد بأسم ,
PoleBird
حط فيه دول
كود PHP:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ShaDow.Database;
using ShaDow.Network.GamePackets;
using ShaDow.Game.ConquerStructures.Society;

namespace 
ShaDow.Game
{
    public class 
PoleBird
    
{
        public static 
SobNpcSpawn PoleRightGateLeftGate;

        public static 
SobNpcSpawn Poles;

        public static 
SafeDictionary<uintGuildScores = new SafeDictionary<uintGuild>(100);

        public static 
bool IsWar falseFlame10th falseFirstRound false;

        public static 
Time32 ScoreSendStampLastWin;

        public static 
Guild PoleKeeperBiCurrentTopLeader;

        private static 
bool changed false;

        private static 
string[] scoreMessages;

        public static 
DateTime StartTime;

        public static 
bool Claim
        
{
            
get { return Program.Vars["biclaim"]; }
            
set Program.Vars["biclaim"] = value; }
        }

        public static 
uint KeeperID
        
{
            
get { return Program.Vars["bikeeperid"]; }
            
set Program.Vars["bikeeperid"] = value; }
        }

        public static 
void Initiate()
        {
            var 
Map Kernel.Maps[2075];
            
Pole = (SobNpcSpawn)Map.Npcs[816];
            
LeftGate = (SobNpcSpawn)Map.Npcs[516082];
            
RightGate = (SobNpcSpawn)Map.Npcs[516083];
        }

        
//public static void EliteGwint()
        //{
        //    var Map = Kernel.Maps[2071];
        //    Poles = (SobNpcSpawn)Map.Npcs[811];
        //}

        
public static void Start()
        {
            if (
LeftGate == null) return;
            
Scores = new SafeDictionary<uintGuild>(100);
            
StartTime DateTime.Now;
            
LeftGate.Mesh = (ushort)(240 LeftGate.Mesh 10);
            
RightGate.Mesh = (ushort)(270 LeftGate.Mesh 10);
            
LeftGate.Hitpoints LeftGate.MaxHitpoints;
            
RightGate.Hitpoints RightGate.MaxHitpoints;
            
Pole.Hitpoints Pole.MaxHitpoints;
            
Kernel.SendWorldMessage(new Message("PoleBird war has began!"System.Drawing.Color.RedMessage.Center),
                
Program.GamePool);
            
FirstRound true;
            foreach (
Guild guild in Kernel.Guilds.Values)
            {
                
guild.BiScore 0;
            }
            
Update upd = new Update(true);
            
upd.UID LeftGate.UID;
            
upd.Append(Update.MeshLeftGate.Mesh);
            
upd.Append(Update.HitpointsLeftGate.Hitpoints);
            
Kernel.SendWorldMessage(updProgram.GamePool, (ushort)2075);
            
upd.Clear();
            
upd.UID RightGate.UID;
            
upd.Append(Update.MeshRightGate.Mesh);
            
upd.Append(Update.HitpointsRightGate.Hitpoints);
            
Kernel.SendWorldMessage(updProgram.GamePool, (ushort)2075);
            
Claim false;
            
IsWar true;
        }

        public static 
void Reset()
        {
            
Scores = new SafeDictionary<uintGuild>(100);

            
LeftGate.Mesh = (ushort)(240 LeftGate.Mesh 10);
            
RightGate.Mesh = (ushort)(270 LeftGate.Mesh 10);

            
LeftGate.Hitpoints LeftGate.MaxHitpoints;
            
RightGate.Hitpoints RightGate.MaxHitpoints;
            
Pole.Hitpoints Pole.MaxHitpoints;

            
Update upd = new Update(true);
            
upd.UID LeftGate.UID;
            
upd.Append(Update.MeshLeftGate.Mesh);
            
upd.Append(Update.HitpointsLeftGate.Hitpoints);
            
Kernel.SendWorldMessage(updProgram.GamePool, (ushort)2075);
            
upd.Clear();
            
upd.UID RightGate.UID;
            
upd.Append(Update.MeshRightGate.Mesh);
            
upd.Append(Update.HitpointsRightGate.Hitpoints);
            
Kernel.SendWorldMessage(updProgram.GamePool, (ushort)2075);

            foreach (
Guild guild in Kernel.Guilds.Values)
            {
                
guild.BiScore 0;
            }

            
IsWar true;
        }

        public static 
void FinishRound()
        {
            if (
PoleKeeperBi != null && !FirstRound)
            {
                if (
PoleKeeperBi.Wins == 0)
                    
PoleKeeperBi.Losts++;
                else
                    
PoleKeeperBi.Wins--;
                
Database.GuildTable.UpdateGuildWarStats(PoleKeeperBi);
            }
            
LastWin Time32.Now;

            
FirstRound false;
            
SortScores(out PoleKeeperBi);
            if (
PoleKeeperBi != null)
            {
                
KeeperID PoleKeeperBi.ID;
                
Kernel.SendWorldMessage(
                    new 
Message(
                        
"The guild, " PoleKeeperBi.Name ", owned by " PoleKeeperBi.LeaderName +
                        
" has won this guild war round!"System.Drawing.Color.RedMessage.Center), Program.GamePool);
                
Kernel.SendWorldMessage(
                    new 
Message("It is generald pardon time. You have 5 minutes to leave, run for your life!",
                        
System.Drawing.Color.WhiteMessage.TopLeft), Program.GamePool, (ushort)6001);

                if (
PoleKeeperBi.Losts == 0)
                    
PoleKeeperBi.Wins++;
                else
                    
PoleKeeperBi.Losts--;
                
Database.GuildTable.UpdateGuildWarStats(PoleKeeperBi);
                
Pole.Name PoleKeeperBi.Name;
            }
            
Pole.Hitpoints Pole.MaxHitpoints;
            
Kernel.SendWorldMessage(PoleProgram.GamePool, (ushort)2075);
            
Reset();
        }

        public static 
void End()
        {
            if (
PoleKeeperBi != null)
            {
                
Kernel.SendWorldMessage(
                    new 
Message(
                        
"The Guild War, " PoleKeeperBi.Name ", owned by " PoleKeeperBi.LeaderName +
                        
" has won this guild war!---Guild war has ended!"System.Drawing.Color.WhiteMessage.Center),
                    
Program.GamePool);
                
Database.GuildTable.UpdatePoleKeeperBi(PoleKeeperBi);
            }
            else
            {
                
Kernel.SendWorldMessage(
                    new 
Message("Guild war has ended and there was no winner!"System.Drawing.Color.RedMessage.Center),
                    
Program.GamePool);
            }
            
IsWar false;
            
Claim true;
            
UpdatePole(Pole);
        }

        public static 
void AddScore(uint addScoreGuild guild)
        {
            if (
guild != null)
            {
                
guild.BiScore += addScore;
                
changed true;
                if (!
Scores.ContainsKey(guild.ID))
                    
Scores.Add(guild.IDguild);
                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.GamePool, (ushort)2075);
                
Kernel.SendWorldMessage(msgProgram.GamePool, (ushort)6001);
            }
        }

        private static 
void SortScores(out Guild winner)
        {
            
winner null;
            List<
stringret = new List<string>();

            
int Place 0;
            foreach (
Guild guild in Scores.Values.OrderByDescending((p) => p.BiScore))
            {
                if (
Place == 0)
                    
winner guild;
                
string str "No  " + (Place 1).ToString() + ": " guild.Name "(" guild.BiScore ")";
                
ret.Add(str);
                
Place++;
                if (
Place == 4)
                    break;
            }

            
changed false;
            
scoreMessages ret.ToArray();
        }

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


افتح
كود PHP:

Handle.cs 

ابحث عن ,
كود PHP:

if (attacker.MapID == 2071

هتضيف فوقيها دول ,
كود PHP:

if (attacker.MapID == 2075)
            {
                if (
attacker.GuildID == || !Game.PoleBird.IsWar)
                {
                    if (
attacked.UID == 816)
                    {
                        return 
false;
                    }
                }
                if (
Game.PoleBird.PoleKeeperBi != null)
                {
                    if (
Game.PoleBird.PoleKeeperBi == attacker.Owner.Guild)
                    {
                        if (
attacked.UID == 816)
                        {
                            return 
false;
                        }
                    }
                    else if (
attacked.UID == 516083 || attacked.UID == 516082)
                    {
                        if (
Game.PoleBird.PoleKeeperBi == attacker.Owner.Guild)
                        {
                            if (
attacker.PKMode == Enums.PKMode.Team)
                                return 
false;
                        }
                    }
                }
            } 

فـ نفس المكان ابحث عن ,
كود PHP:

Game.GuildWar.AddScore(damageattacker.Owner.Guild); 

بعد اخر قوصين ,
ضيف دة
كود PHP:

if (attacker.MapID == 2075)
            {
                if (
attacked.UID == 816)
                {
                    if (
Game.PoleBird.PoleKeeperBi == attacker.Owner.Guild)
                        return;
                    if (
attacked.Hitpoints <= damage)
                        
attacked.Hitpoints 0;
                    
Game.PoleBird.AddScore(damageattacker.Owner.Guild);
                }
            } 

افتح
كود PHP:

Guild.cs 

ابحث عن ,
كود PHP:

public uint WarScore

وضيف تحته
كود PHP:

public uint BiScore

فنفس المكان ,
وابحث عن
كود PHP:

public Guild(string leadername

فوقيها ضيف دة ,
كود PHP:

public bool PoleKeeperBi
        
{
            
get
            
{
                return 
PoleBird.Pole.Name == Name;
            }
        } 

افتح GuildTable.cs
وبحث عن ,
كود PHP:

guild.SendGuildLevel(); 

ضيف تحتها دة ,
كود PHP:

if (reader.ReadUInt32("PoleKeeperBi") == 1)
                    {
                        
Game.PoleBird.PoleKeeperBi guild;
                    } 

افتح PacketHandler.cs
بحث عن ,
كود PHP:

if (client.Entity.MapID == 1038 && ShaDow.Game.GuildWar.IsWar || 

طبعا مش هتلاقيها عشان اسم البروجيكت مختلف ,
غير بأسم البروجكت بتاعك ,
وهتضيف جمبها ,
كود PHP:

|| client.Map.BaseID == 2075 && ShaDow.Game.PoleBird.IsWar 

مش تنسا تغير اسم البروجيكت بردو ,
..
ابحث عن
كود PHP:

if (client.Map.BaseID != 6001 && client.Map.BaseID != 6004 && !client.Entity.Dead && req.OptionID == 249 && client.Map.BaseID != 700

وبعد اخر قوص فيها ,
هتضيف دة ,
كود PHP:

if (client.Map.BaseID != 6001 && client.Map.BaseID != 6004 && !client.Entity.Dead && req.OptionID == 244 && client.Map.BaseID != 700)//PoleBird
                        
{
                            
client.Entity.Teleport(2075737650);
                        } 

وضيف دة تحت اى شفرة عندك عشان تقدر تفتح وتقفل البولا ,
كود PHP:

case "PBird":
                                {
                                    switch (
Data[1])
                                    {
                                        case 
"on":
                                            
PoleBird.Start();
                                            break;
                                        case 
"off":
                                            
PoleBird.End();
                                            break;
                                    }
                                    break; 

كمل وافتح ,
Cpanl لو مش عندك , افتح Rates
وضيف دة ,
كود PHP:

PoleBird reader.ReadUInt32("PoleBird"); 

وبحث بردو عن ,
كود PHP:

public static uint GuildWar

ضيف تحته ,
كود PHP:

public static uint PoleBird

Programe.cs
ضيف دة
كود PHP:

Game.PoleBird.Initiate(); 

وده كمان
كود PHP:

Console.WriteLine("PoleBird War initilizated."); 

World.cs
ضيف الانفيت
كود PHP:

#region PoleBird

            
if (PoleBird.IsWar)
            {
                if (
Time32.Now PoleBird.ScoreSendStamp.AddSeconds(3))
                {
                    
PoleBird.ScoreSendStamp Time32.Now;
                    
PoleBird.SendScores();
                }
            }
            if ((
Now64.Hour >= 01 && Now64.Hour <= 21) && Now64.DayOfWeek == DayOfWeek.Wednesday)
            {
                if (!
PoleBird.IsWar)
                {
                    
PoleBird.Start();
                }
            }
            if (
Now64.Hour == 21 && Now64.Minute == 00 && Now64.Second == 00 && PoleBird.IsWar)
            {
                foreach (var 
client in Program.GamePool)
                    if (
client.Entity.GuildID != && client.Entity.MapID != 6004)
                        
client.MessageBox("PoleBird War has begun! Would you like to join?",
                            
=> { p.Entity.Teleport(1002224237); }, null);
            }
            if (
PoleBird.IsWar)
            {
                if (
Now64.Hour == 22 && Now64.Minute == 00 && Now64.Second == 00)
                {
                    
PoleBird.End();
                }
            }

            
#endregion 

Npcs.cs
كود PHP:

#region PoleBird
                                #region Pole

                                
case 816:
                                    {
                                        
dialog.Text("Please, don't hurt me!.");
                                        
dialog.Option("Sorry."255);
                                        
dialog.Send();
                                        break;
                                    }

                                
#endregion
                                #region ClaimGuildPrize
                                
case 4482119:
                                    {
                                        switch (
npcRequest.OptionID)
                                        {
                                            case 
0:
                                                {
                                                    
dialog.Text(
                                                        
"Hello there. Do you want to Claim PoleBird Prize you can only Claim it 1 Time if you won PT.");
                                                    
dialog.Option("Leme Claim."1);
                                                    
dialog.Option("Just Passing By!"255);
                                                    
dialog.Send();
                                                    break;
                                                }
                                            case 
1:
                                                {
                                                    if (
client.Guild != null)
                                                    {
                                                        if (
client.Guild.PoleKeeperBi && client.Guild != null &&
                                                            
client.AsMember.Rank ==
                                                            
ShaDow.Game.Enums.GuildMemberRank.GuildLeader)
                                                        {
                                                            
dialog.Text("Are you sure you want to Claim your Prize?");
                                                            
dialog.Option("Yes."2);
                                                            
dialog.Option("Ah, nevermind."255);
                                                            
dialog.Send();
                                                        }
                                                        else
                                                        {
                                                            
dialog.Text(
                                                                
"Sorry only GuildLeader of the Winner Guild can Claim The Prize After PoleBird End.");
                                                            
dialog.Option("Ahh."255);
                                                            
dialog.Send();
                                                        }
                                                    }
                                                    else
                                                    {
                                                        
dialog.Text("Sorry You are not Member in any guild yet");
                                                        
dialog.Option("Ahh."255);
                                                        
dialog.Send();
                                                    }
                                                    break;
                                                }
                                            case 
2:
                                                {
                                                    if (
DateTime.Now.DayOfWeek == DayOfWeek.Wednesday && DateTime.Now.Hour <= 22 &&
                                                        !
PoleBird.IsWar && PoleBird.Claim && client.Guild != null &&
                                                        
client.Entity.GuildID == PoleBird.KeeperID &&
                                                        
client.Entity.GuildRank == (ushort)Game.Enums.GuildMemberRank.GuildLeader)
                                                    {
#warning GUILD WAR PRIZE
                                                        
Program.AddWarLog("PoleBird", +Database.CPanel.PoleBird "",
                                                            
client.Entity.Name);
                                                        
PoleBird.Claim false;
                                                        
PoleBird.KeeperID 0;
                                                        
client.Entity.ConquerPoints += Database.CPanel.PoleBird;
                                                        
//client.RacePoints += Database.ServerRates.gwpts;
                                                        //ClassPk.AddGl();
                                                        
client.Inventory.Add(72346701);
                                                        
//client.Entity.AddTopStatus(Update.Flags.TopGuildLeader,
                                                        //    DateTime.Now.AddDays(7));
                                                        
ShaDow.Kernel.SendWorldMessage(
                                                            new 
Message(
                                                                
"Congratulations! " client.Entity.Name " Leader of " +
                                                                
client.Guild.PoleKeeperBi +
                                                                
" The winner guild has Claimed PoleBird Prize " +
                                                                
Database.CPanel.PoleBird +
                                                                
" cps and LordToken And 1000 GW Points!"System.Drawing.Color.White,
                                                                
Message.TopLeft), Program.GamePool);
                                                    }
                                                    else
                                                    {
                                                        
dialog.Text(
                                                            
"Sorry you dont have Any Prize to claim only GL of the winner guild can claim Prize After PT");
                                                        
dialog.Option("Ahh."255);
                                                        
dialog.Send();
                                                    }
                                                    break;
                                                }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Gates

                                
case 516082:
                                    {
                                        if (
client.Guild != null)
                                        {
                                            if (
client.Guild.PoleKeeperBi)
                                            {
                                                switch (
npcRequest.OptionID)
                                                {
                                                    case 
0:
                                                        
dialog.Text("Select the option you want to pursue.");
                                                        if (
client.AsMember.Rank !=
                                                            
ShaDow.Game.Enums.GuildMemberRank.Member)
                                                        {
                                                            
dialog.Option("Open gate."1);
                                                            
dialog.Option("Close gate."2);
                                                        }
                                                        
dialog.Option("Get inside."3);
                                                        
dialog.Option("Nothing."255);
                                                        
dialog.Send();
                                                        break;
                                                    case 
1:
                                                        {
                                                            
ShaDow.Game.PoleBird.LeftGate.Mesh =
                                                                (
ushort)
                                                                    (
250 ShaDow.Game.PoleBird.LeftGate.Mesh 10);

                                                            
Update upd = new Update(true);
                                                            
upd.UID ShaDow.Game.PoleBird.LeftGate.UID;
                                                            
upd.Append(Update.Mesh,
                                                                
ShaDow.Game.PoleBird.LeftGate.Mesh);
                                                            
client.SendScreen(updtrue);
                                                            break;
                                                        }
                                                    case 
2:
                                                        {
                                                            
Game.PoleBird.LeftGate.Mesh =
                                                                (
ushort)(240 Game.PoleBird.LeftGate.Mesh 10);
                                                            if (
PoleBird.LeftGate.Hitpoints 100)
                                                                
PoleBird.LeftGate.Hitpoints PoleBird.LeftGate.MaxHitpoints;
                                                            
Update upd = new Update(true);
                                                            
upd.UID ShaDow.Game.PoleBird.LeftGate.UID;
                                                            
upd.Append(Update.Mesh,
                                                                
ShaDow.Game.PoleBird.LeftGate.Mesh);
                                                            
upd.Append(Update.Hitpoints,
                                                                
ShaDow.Game.PoleBird.LeftGate.Hitpoints);
                                                            
client.SendScreen(updtrue);
                                                            break;
                                                        }
                                                    case 
3:
                                                        {
                                                            
client.Entity.Teleport(2075737601);
                                                            break;
                                                        }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                case 
516083:
                                    {
                                        if (
client.Guild != null)
                                        {
                                            if (
client.Guild.PoleKeeperBi)
                                            {
                                                switch (
npcRequest.OptionID)
                                                {
                                                    case 
0:
                                                        
dialog.Text("Select the option you want to pursue.");
                                                        if (
client.AsMember.Rank !=
                                                            
ShaDow.Game.Enums.GuildMemberRank.Member)
                                                        {
                                                            
dialog.Option("Open gate."1);
                                                            
dialog.Option("Close gate."2);
                                                        }
                                                        
dialog.Option("Get inside."3);
                                                        
dialog.Option("Nothing."255);
                                                        
dialog.Send();
                                                        break;
                                                    case 
1:
                                                        {
                                                            
ShaDow.Game.PoleBird.RightGate.Mesh =
                                                                (
ushort)
                                                                    (
280 ShaDow.Game.PoleBird.RightGate.Mesh 10);

                                                            
Update upd = new Update(true);
                                                            
upd.UID ShaDow.Game.PoleBird.RightGate.UID;
                                                            
upd.Append(Update.Mesh,
                                                                
ShaDow.Game.PoleBird.RightGate.Mesh);
                                                            
client.SendScreen(updtrue);
                                                            break;
                                                        }
                                                    case 
2:
                                                        {
                                                            
ShaDow.Game.PoleBird.RightGate.Mesh =
                                                                (
ushort)
                                                                    (
270 ShaDow.Game.PoleBird.RightGate.Mesh 10);
                                                            if (
PoleBird.RightGate.Hitpoints 100)
                                                                
Game.PoleBird.RightGate.Hitpoints =
                                                                    
Game.PoleBird.RightGate.MaxHitpoints;
                                                            
Update upd = new Update(true);
                                                            
upd.UID ShaDow.Game.PoleBird.RightGate.UID;
                                                            
upd.Append(Update.Mesh,
                                                                
ShaDow.Game.PoleBird.RightGate.Mesh);
                                                            
upd.Append(Update.Hitpoints,
                                                                
ShaDow.Game.PoleBird.RightGate.Hitpoints);
                                                            
client.SendScreen(updtrue);
                                                            break;
                                                        }
                                                    case 
3:
                                                        {
                                                            
client.Entity.Teleport(2075765571);
                                                            break;
                                                        }
                                                }
                                            }
                                        }
                                        break;
                                    }

                                
#endregion
                                #endregion 

وافتح
النافى كات وكمل معايا ,
..
افتح Cpanl
فالقاعدة , أو Rates زي ما قولنا , لو مش عندك سى بانل ,
واعمل DesingTable
وحط السطر دة ,
كود:
كود PHP:

PoleBird    int    45    0    0    0    0    0    0    0    0                    0    0 

كود PHP:

2075    1015    7    0
816    ShaDowz    10    1137    2075    724    573    30000000    30000000    0    17    1    0
516082    ii    26    251    2075    735    617    10000000    10000000    24    21    0    0
516083    ii    26    277    2075    781    569    10000000    10000000    27    21    0    0 

كدة تمام 100% والحمد لله ,



الساعة الآن 11:06 PM

مرحبا بكم في منتدي اكواد لتطوير الالعاب