Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 10:23

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



clan war impluse source 5517

Discussion on clan war impluse source 5517 within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
zoro7070's Avatar
 
elite*gold: 0
Join Date: Aug 2008
Posts: 144
Received Thanks: 18
help with clan war impluse source 5517

i make clanwar for my server
but there is some problem
clans score don't appear at screen
clan name don't change at the clan pole
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.Database;
using Conquer_Online_Server.Network.GamePackets;
using Conquer_Online_Server.ServerBase;

namespace Conquer_Online_Server.Game.Tournaments
{
    class ClanWar
    {
        private static bool changed = false;
        public static int Claim = 0;
        public static SobNpcSpawn ClanFlag, ClanFlag2;
        public static Conquer_Online_Server.Game.Clans CurrentTopLeader;
        public static bool FirstRound = false;
        public static bool IsWar = false;
        public static Time32 LastWin;
        public static Conquer_Online_Server.Game.Clans PoleKeeper;
        private static string[] scoreMessages;
        public static SafeDictionary<uint, Conquer_Online_Server.Game.Clans> Scores = new SafeDictionary<uint, Conquer_Online_Server.Game.Clans>(100);
        public static Time32 ScoreSendStamp;
        public static DateTime StartTime;

        public static void AddScore(uint addScore, Conquer_Online_Server.Game.Clans clan)
        {
            if (clan != null)
            {
                clan.WarScore += addScore;
                if ((int)ClanFlag.Hitpoints <= 0)
                {
                    FinishRound();
                    return;
                }
                else
                {
                    changed = true;
                    if (!Scores.ContainsKey(clan.ClanId))
                    {
                        Scores.Add(clan.ClanId, clan);
                        SendScores();
                    }
                }
            }
        }

        public static void End()
        {
            if (ClanFlag != null)
            {
                Kernel.SendWorldMessage(new Message("The Clan, " + PoleKeeper.ClanName + ", owned by " + PoleKeeper.ClanLider + " has won this Clan war!---Clan war has ended!", System.Drawing.Color.White, 0x7db), Kernel.GamePool.Values);
            }
            else
            {
                Kernel.SendWorldMessage(new Message("Clan war has ended and there was no winner!", System.Drawing.Color.Red, 0x7db), Kernel.GamePool.Values);
            }
            IsWar = false;
            UpdatePole(ClanFlag);
        }

        public static void FinishRound()
        {
            if (!((PoleKeeper == null) || FirstRound))
            {
            }
            LastWin = Time32.Now;
            FirstRound = false;
            SortScores(out PoleKeeper);
            if (PoleKeeper != null)
            {
                Kernel.SendWorldMessage(new Message("The Clan, " + PoleKeeper.ClanName + ", owned by " + PoleKeeper.ClanLider + " has won this Clan war round!", System.Drawing.Color.Red, Message.Center), ServerBase.Kernel.GamePool.Values);
                ClanFlag.Name = PoleKeeper.ClanName;
            }
            ClanFlag.Hitpoints = ClanFlag.MaxHitpoints;
            Kernel.SendWorldMessage(ClanFlag, Kernel.GamePool.Values, (ushort)0x5e5);
            Reset();
            UpdatePole(ClanFlag);
        }

        public static void Initiate()
        {
            var Map = Kernel.Maps[1509];
            ClanFlag = (SobNpcSpawn)Map.Npcs[812];
        }

        public static void Reset()
        {
            Scores = new SafeDictionary<uint, Conquer_Online_Server.Game.Clans>(100);
            ClanFlag.Hitpoints = ClanFlag.MaxHitpoints;
            IsWar = true;
        }

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

            if (changed)
            {
                SortScores(out CurrentTopLeader);

                for (int i = 0; i < scoreMessages.Length; i++)
                {
                    Message message = new Message(scoreMessages[i], System.Drawing.Color.Red, i == 0 ? Message.FirstRightCorner : Message.ContinueRightCorner);
                    Kernel.SendWorldMessage(message, ServerBase.Kernel.GamePool.Values, (ushort)1509);
                }
            }
        }

        private static void SortScores(out Conquer_Online_Server.Game.Clans winner)
        {
            winner = null;
            List<string> list = new List<string>();
            string item = Constants.ServerName + " ClanWar:";
            list.Add(item);
            SortedDictionary<uint, SortEntry<uint, Conquer_Online_Server.Game.Clans>> source = new SortedDictionary<uint, SortEntry<uint, Conquer_Online_Server.Game.Clans>>();
            foreach (Conquer_Online_Server.Game.Clans clans in Scores.Values)
            {
                if (Kernel.ServerClans.ContainsKey(clans.ClanId))
                {
                    if (source.ContainsKey(clans.WarScore))
                    {
                        source[clans.WarScore].Values.Add(clans.ClanId, clans);
                    }
                    else
                    {
                        source.Add(clans.WarScore, new SortEntry<uint, Conquer_Online_Server.Game.Clans>());
                        source[clans.WarScore].Values = new Dictionary<uint, Conquer_Online_Server.Game.Clans>();
                        source[clans.WarScore].Values.Add(clans.ClanId, clans);
                    }
                }
            }
            int num = 0;
            foreach (KeyValuePair<uint, SortEntry<uint, Conquer_Online_Server.Game.Clans>> pair in source.Reverse<KeyValuePair<uint, SortEntry<uint, Conquer_Online_Server.Game.Clans>>>())
            {
                foreach (Conquer_Online_Server.Game.Clans clans in pair.Value.Values.Values)
                {
                    if (num == 0)
                    {
                        winner = clans;
                    }
                    object[] objArray = new object[] { "No  ", (num + 1).ToString(), ": ", clans.ClanName, "(", pair.Key, ")" };
                    string str2 = string.Concat(objArray);
                    list.Add(str2);
                    num++;
                    if (num == 4)
                    {
                        break;
                    }
                }
                if (num == 4)
                {
                    break;
                }
            }
            changed = false;
            scoreMessages = list.ToArray();
        }

        public static void Start()
        {
            Scores = new SafeDictionary<uint, Conquer_Online_Server.Game.Clans>(100);
            StartTime = DateTime.Now;
            Kernel.SendWorldMessage(new Message("Clan war has began!", System.Drawing.Color.Red, 0x7db), Kernel.GamePool.Values);
            FirstRound = true;
            IsWar = true;
        }

        public static void UpdatePole(SobNpcSpawn ClanFlag)
        {
            new Database.MySqlCommand(Conquer_Online_Server.Database.MySqlCommandType.UPDATE)
            .Update("sobnpcs").Set("name", ClanFlag.Name)
            .Set("life", (long)ClanFlag.Hitpoints).Where("id", (long)ClanFlag.UID).Execute();
        }
    }
}
zoro7070 is offline  
Old 01/04/2013, 05:15   #2
 
elite*gold: 0
Join Date: Jan 2013
Posts: 2
Received Thanks: 0
very

very good
amr69940 is offline  
Old 01/05/2013, 15:21   #3
 
zoro7070's Avatar
 
elite*gold: 0
Join Date: Aug 2008
Posts: 144
Received Thanks: 18
can anyone help with that
zoro7070 is offline  
Reply


Similar Threads Similar Threads
help me source 5517 plz :(
10/20/2012 - CO2 Private Server - 11 Replies
http://img5.pimp-my-profile.com/i57/5/9/30/f_a9b54 b44b2ca.jpg hello need help with that mistake a person who knows how repair it if you could tell me how to fix it I will appreciate endlessly only error is that I Please ask him to give me help with that 58 errors and error screen time GameState.cs 842 help me plz :(
some help with 5517 trinity source
05/25/2012 - CO2 Private Server - 8 Replies
how can i make the autoinvite window don't show in a map and i have problem with that npc the npc upgrade the items above 140 #region Weapon Master case 7050: { switch (npcRequest.OptionID) { case 0: {
Need help Revelation source [5517]
05/11/2012 - CO2 Private Server - 3 Replies
Hi, I try to start a conquer server but i've a problem with the loader. When I use the server.dat (encrypted) from conquer online, I see all of the servers, But when I edit the server.dat (no encrypted) to my IP address I don't see any server. what am I doing wrong? Thanks,
plz help me i have problem in source 5517
04/06/2012 - CO2 Private Server - 6 Replies
i have problem in consol http://www11.0zz0.com/2012/04/04/17/242976789.jpg http://www11.0zz0.com/2012/04/04/17/826798415.jpg http://www11.0zz0.com/2012/04/04/17/299833993.jpg
Monster Spawn impluse Source
05/13/2010 - CO2 Private Server - 9 Replies
can someone explain to me how to create Monsters spawn cuze thier r no monsters if you really wanted to help just give a pic or add me at yahoo to explain that with team viewer hoppe someone will do :)



All times are GMT +1. The time now is 10:24.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.