Register for your free account! | Forgot your password?

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

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

Advertisement



[Relase] Guilds for CoEmuv2

Discussion on [Relase] Guilds for CoEmuv2 within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
[Relase] Guilds for CoEmuv2

Hi all. Here is my way to get guilds work on CoEmuv2.
First of all, make copy of your source, before you start doing anything with it. To avoid any bugs read carefully that guide. I have spent some time to get it work, so press Thank if it helps.

So lets start.

1.Create new class file Guild.cs under GS>Entities and paste whole code:
Code:
/*
 * Created by Bisiol.
 */
using System;
using System.Collections;
using System.Collections.Generic;
using System.Timers;
using CoEmu_v2_GameServer.Connections;
using CoEmu_v2_GameServer.Structs;
using CoEmu_v2_GameServer.Packets;
using CoEmu_v2_GameServer.Database;

namespace CoEmu_v2_GameServer.Entities
{
    /// <summary>
    /// A conquer online guild.
    /// </summary>
    public class Guild
    {
        public ushort ID;//Guild ID
        public string Name;//Guild Name

        public member Leader;// Guild Leader
        public Dictionary<int, member> Members = new Dictionary<int, member>();//Members(normal and DL)

        public int Fund;//Guild Fund
        public uint MembersCount;//Number of all members
        public string Bulletin; //Bulletin

        /// <summary>
        /// Remove member from guild and sent message to guild members.
        /// </summary>
        public void PlayerQuits(Character Quitter)
        {
            Members.Remove(Quitter.ID);

            GuildMessage(Quitter.Name + " has left our guild.");

            MembersCount--;
        }

        public static void refresh(ClientSocket CSocket)
        {
            if (CSocket.Client.InGuild && Nano.Guilds.ContainsKey(CSocket.Client.gid))
            {
                Guild gd = Nano.Guilds[CSocket.Client.gid];
                CSocket.Send(ConquerPacket.GName(CSocket.Client.gid, CSocket.Client.gna));
                CSocket.Send(ConquerPacket.Ginfo(gd, CSocket.Client));
                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, gd.Bulletin, Struct.ChatType.GuildBulletin));
            }
        }
        public void GuildMessage(string Message)
        {
            if (Nano.ClientPool.ContainsKey(Leader.ID))
            {
                Nano.ClientPool[Leader.ID].Send(ConquerPacket.Chat(0, "Guild", "All", Message, Struct.ChatType.Guild));
            }

            foreach (KeyValuePair<int, member> mb in Members)
            {
                if (Nano.ClientPool.ContainsKey(mb.Value.ID))
                {
                    Nano.ClientPool[mb.Value.ID].Send(ConquerPacket.Chat(0, "Guild", "All", Message, Struct.ChatType.Guild));
                }
            }
        }

    }
    public class member : IComparable<member>
    {
        public int ID;
        public string Name = "";
        public bool isDL = false;
        public int lvl;
        public int Donation = 0;
        #region IComparable<member> Members

        public int CompareTo(member other)
        {
            return other.lvl.CompareTo(this.lvl);
        }

        #endregion
    }
}
2.Create new class file Guild.cs under GS>Packets and paste whole code:
Code:
/*
 * Created by Bisiol.
 */
using System;
using CoEmu_v2_GameServer.Connections;
using CoEmu_v2_GameServer.Entities;

namespace CoEmu_v2_GameServer.Packets
{
    /// <summary>
    /// Guild packets.
    /// </summary>
    public partial class ConquerPacket
    {
        public static byte[] GSend(int GuildID, byte Type)
        {
            PacketBuilder Packet = new PacketBuilder(0x453, 12);
            Packet.Long(Type);
            Packet.Long(GuildID);
            return Packet.getFinal();
        }

        public static byte[] Ginfo(Guild gd, Character ch)
        {
            PacketBuilder Packet = new PacketBuilder(0x452, 21 + gd.Leader.Name.Length);
            Packet.Long(gd.ID); //id
            Packet.Long(ch.donation); //don
            Packet.Long(gd.Fund); //fund
            Packet.Long(gd.MembersCount); //mc
            Packet.Int(ch.gpo); //pos
            Packet.Text(gd.Leader.Name); //gl
            return Packet.getFinal();
        }
        public static byte[] GName(ushort ID, string Name)
        {
            PacketBuilder Packet = new PacketBuilder(1015, 11 + Name.Length);
            Packet.Short(ID);
            Packet.Int(0);
            Packet.Int(0);
            Packet.Int(3);
            Packet.Int(1);
            Packet.Int(Name.Length);
            for (int i = 0; i < Name.Length; i++)
            {
                Packet.Int(Convert.ToByte(Name[i]));
            }

            return Packet.getFinal();
        }
        public static byte[] GList(long CharId, byte Type, string name, byte Count)
        {
            PacketBuilder Packet = new PacketBuilder(1015, 10 + name.Length);
            Packet.Long((uint)CharId);
            Packet.Int(Type);
            Packet.Int((byte)Count);
            Packet.Text(name);
            return Packet.getFinal();
        }
    }
}
3. Go to GS>PacketProcessor.cs and search for:

Code:
#region CreateCharacter
case 1001://Create Character
Above add:
Code:
                    #region 3F7(1015),485(1107) guild

                    case 1015://Send guild members
                        {
                            string PackMembers = "";
                            string OnlineGL = "";
                            string OfflineGL = "";
                            string OnlineDL = "";
                            string OfflineDL = "";
                            string Online = "";
                            string Offline = "";
                            Guild GD = Nano.Guilds[CSocket.Client.gid];

                            if (Nano.ClientPool.ContainsKey(GD.Leader.ID))
                                OnlineGL += Convert.ToChar((GD.Leader.Name + " " + GD.Leader.lvl.ToString() + " 1").Length) + GD.Leader.Name + " " + GD.Leader.lvl.ToString() + " 1";
                            else
                                OfflineGL += Convert.ToChar((GD.Leader.Name + " " + GD.Leader.lvl.ToString() + " 0").Length) + GD.Leader.Name + " " + GD.Leader.lvl.ToString() + " 0";

                            List<member> ms = new List<member>();
                            foreach (KeyValuePair<int, member> mb in GD.Members)
                            {
                                ms.Add(mb.Value);
                            }
                            ms.Sort();
                            foreach (member m in ms)
                            {
                                if (m.isDL)
                                {
                                    if (Nano.ClientPool.ContainsKey(m.ID))
                                        OnlineDL += Convert.ToChar((m.Name + " " + m.lvl.ToString() + " 1").Length) + m.Name + " " + m.lvl.ToString() + " 1";
                                    else
                                        OfflineDL += Convert.ToChar((m.Name + " " + m.lvl.ToString() + " 0").Length) + m.Name + " " + m.lvl.ToString() + " 0";
                                }
                                else
                                {
                                    if (Nano.ClientPool.ContainsKey(m.ID))
                                        Online += Convert.ToChar((m.Name + " " + m.lvl.ToString() + " 1").Length) + m.Name + " " + m.lvl.ToString() + " 1";
                                    else
                                        Offline += Convert.ToChar((m.Name + " " + m.lvl.ToString() + " 0").Length) + m.Name + " " + m.lvl.ToString() + " 0";
                                }
                            }
                            PackMembers = OnlineGL + OfflineGL + OnlineDL + OfflineDL + Online + Offline;
                            CSocket.Send(ConquerPacket.GList(11, 11, PackMembers, (byte)(1 + GD.Members.Count)));
                            break;
                        }
                    case 1107:
                        {
                            uint UID = BitConverter.ToUInt32(data, 8);
                            byte Typee = Data[4];
                            switch (Typee)
                            {
                                case 1://Send Join request
                                    {
                                        ClientSocket target = Nano.ClientPool[(int)UID];
                                        if (!CSocket.Client.InGuild && (target.Client.gpo == 100 || target.Client.gpo == 90))
                                        {
                                            target.Send(ConquerPacket.GSend(CSocket.Client.ID, 1));
                                        }
                                        break;
                                    }
                                case 2://Accept join request
                                    {
                                        if (Nano.ClientPool.ContainsKey((int)UID))
                                        {
                                            ClientSocket target = Nano.ClientPool[(int)UID];
                                            if (!target.Client.InGuild)
                                            {
                                                Guild gd = Nano.Guilds[CSocket.Client.gid];
                                                target.Client.gid = gd.ID;
                                                target.Client.gna = gd.Name;
                                                target.Client.gpo = 50;
                                                target.Client.InGuild = true;
                                                member m = new member();
                                                m.ID = target.Client.ID;
                                                m.Name = target.Client.Name;
                                                m.lvl = target.Client.Level;
                                                gd.Members.Add(m.ID, m);
                                                gd.MembersCount++;
                                                target.Send(ConquerPacket.GName(target.Client.gid, target.Client.gna));
                                                target.Send(ConquerPacket.Ginfo(gd, target.Client));
                                                target.Send(ConquerPacket.Chat(0, "SYSTEM", target.Client.Name, gd.Bulletin, Struct.ChatType.GuildBulletin));
                                                foreach (KeyValuePair<int, Guild> GD in Nano.Guilds)
                                                {
                                                    CSocket.Send(ConquerPacket.GName(GD.Value.ID, GD.Value.Name));
                                                }
                                                Spawn.MeTo(target);
                                                Database.Database.UpdateGuild(gd);

                                            }
                                        }
                                        break;
                                    }
                                case 3://Leave the guild
                                    {
                                        if (CSocket.Client.InGuild && CSocket.Client.gpo != 100)
                                        {
                                            Guild gd = Nano.Guilds[CSocket.Client.gid];
                                            CSocket.Send(ConquerPacket.GSend(CSocket.Client.gid, 19));

                                            gd.PlayerQuits(CSocket.Client);
                                            CSocket.Client.donation = 0;
                                            CSocket.Client.gid = 0;
                                            CSocket.Client.gna = "";
                                            CSocket.Client.gpo = 50;
                                            CSocket.Client.InGuild = false;

                                            Spawn.MeTo(CSocket);
                                            Database.Database.UpdateGuild(gd);
                                        }
                                        break;
                                    }
                                case 6://Get Guild Name
                                    {
                                        CSocket.Send(ConquerPacket.GName((ushort)UID, Nano.Guilds[(int)UID].Name));
                                        Guild.refresh(CSocket);
                                        Spawn.MeTo(CSocket);
                                        break;
                                    }
                                case 11://Donate
                                    {
                                        if (CSocket.Client.InGuild)
                                        {
                                            if (Nano.Guilds.ContainsKey(CSocket.Client.gid))
                                            {
                                                Guild GD = Nano.Guilds[CSocket.Client.gid];
                                                int Amount = BitConverter.ToInt32(Data, 8);

                                                if (CSocket.Client.Money >= Amount)
                                                {
                                                    GD.Fund += Amount;                                                    
                                                    CSocket.Client.Money -= Amount;
                                                    CSocket.Client.donation += Amount;
                                                    if(CSocket.Client.gpo==100)
                                                    GD.Leader.Donation = CSocket.Client.donation;
                                                    else
                                                        GD.Members[CSocket.Client.ID].Donation = CSocket.Client.donation;
                                                    CSocket.Send(ConquerPacket.Ginfo(GD, CSocket.Client));
                                                    CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Money, Struct.StatusTypes.InvMoney));
                                                    Database.Database.UpdateGuild(GD);
                                                    foreach (KeyValuePair<int, ClientSocket> to in Nano.ClientPool)
                                                    {
                                                        if (CSocket.Client.Map == to.Value.Client.Map)
                                                            if (Calculation.CanSeePlus(CSocket.Client.X, CSocket.Client.Y, to.Value.Client.X, to.Value.Client.Y))
                                                                to.Value.Send(ConquerPacket.Chat(0, "SYSTEM", "ALL", CSocket.Client.Name + " has donated " + Amount.ToString() + " silvers to " + CSocket.Client.gna + ".", Struct.ChatType.Top));
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                case 12://Guild status
                                    {
                                        Guild.refresh(CSocket);
                                        break;
                                    }
                            }
                            break;
                        }
                    #endregion
4. Open up GS>Entities>Charater.cs and find:
Code:
		public Timer UpStam;
		public Timer FlashTimer;
bottom add:
Code:
        // guild
        public bool InGuild = false;
        public ushort gid = 0;
        public int gpo = 0;
        public string gna = "";
        public int donation = 0;
5. Go to GS>Calculations>CanSee.cs and after that

Code:
		public static bool CanSee(int SeeX, int SeeY, int MyX, int MyY)
		{
			return (Math.Max(Math.Abs(SeeX - MyX), Math.Abs(SeeY - MyY)) <= 15);
		}
add:

Code:
        public static bool CanSeePlus(int SeeX, int SeeY, int MyX, int MyY)
        {
            return (Math.Max(Math.Abs(SeeX - MyX), Math.Abs(SeeY - MyY)) <= 25);
        }
6. Open GS>Calculations>Exp.cs. Find:

Code:
			CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You have gained three attribute points! Use them wiesely!", Struct.ChatType.Top));
and after that add:

Code:
 if (CSocket.Client.InGuild)
                if (CSocket.Client.gpo == 100)
                    Nano.Guilds[CSocket.Client.gid].Leader.lvl = CSocket.Client.Level;
                else
                    Nano.Guilds[CSocket.Client.gid].Members[CSocket.Client.ID].lvl = CSocket.Client.Level;
7. Go to GS>Nano.cs find:

Code:
		public static Dictionary<int, Struct.TerrainNPC> TerrainNpcs = new Dictionary<int, Struct.TerrainNPC>();
after it add:
Code:
        public static Dictionary<int, Guild> Guilds = new Dictionary<int, Guild>();
8. Open GS>Entities>Spawn.cs and after:
Code:
	public class Spawn
	{
add:
Code:
        public static void MeTo(ClientSocket CSocket)
        {
            try
            {
                Monitor.Enter(Nano.ClientPool);
                foreach (KeyValuePair<int, ClientSocket> Locals in Nano.ClientPool)
                {
                    ClientSocket C = Locals.Value;
                    if ((int)C.Client.Map == (int)CSocket.Client.Map && CSocket.Client.ID != C.Client.ID)
                    {
                        if (Calculation.CanSee(CSocket.Client.X, CSocket.Client.Y, C.Client.X, C.Client.Y))
                        {
                            C.Send(ConquerPacket.General(CSocket.Client.ID, CSocket.Client.PrevX, CSocket.Client.PrevY, 0, 0, 0, Struct.DataType.EntityRemove));
                            CSocket.Send(ConquerPacket.General(C.Client.ID, C.Client.PrevX, C.Client.PrevY, 0, 0, 0, Struct.DataType.EntityRemove));
                            All(C);
                            All(CSocket);
                            CSocket.Send(ConquerPacket.SpawnCharacter(C));
                            C.Send(ConquerPacket.SpawnCharacter(CSocket));
                        }
                    }
                }
                Spawn.All(CSocket);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            finally
            {
                Monitor.Exit(Nano.ClientPool);
            }
        }
9. In GS>Handlers>Chat.cs lock for:

Code:
					case Struct.ChatType.Friend:
						{
							ConquerPacket.ToServer(ConquerPacket.Chat(0, From, To, Message, Struct.ChatType.Friend), CSocket.Client.ID);
							break;
						}
and bottom add:


Code:
                    case Struct.ChatType.GuildBulletin:
                        {
                            if (CSocket.Client.InGuild)
                            {
                                if (Nano.Guilds.ContainsKey(CSocket.Client.gid))
                                {
                                    Nano.Guilds[CSocket.Client.gid].Bulletin = Message;
                                    CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, Nano.Guilds[CSocket.Client.gid].Bulletin, Struct.ChatType.GuildBulletin));
                                    Database.Database.UpdateGuild(Nano.Guilds[CSocket.Client.gid]);
                                }
                            }
                            break;
                        }
                    case Struct.ChatType.Guild:
                        {
                            if (Nano.ClientPool.ContainsKey(Nano.Guilds[CSocket.Client.gid].Leader.ID))
                                if (Nano.Guilds[CSocket.Client.gid].Leader.ID != CSocket.Client.ID)
                                    Nano.ClientPool[Nano.Guilds[CSocket.Client.gid].Leader.ID].Send(ConquerPacket.Chat(0, CSocket.Client.Name, To, Message, Type));
                                    
                                    foreach (KeyValuePair<int, member> M in Nano.Guilds[CSocket.Client.gid].Members)
                                    {
                                        if(Nano.ClientPool.ContainsKey(M.Value.ID))
                                            if (M.Value.ID != CSocket.Client.ID)
                                                Nano.ClientPool[M.Value.ID].Send(ConquerPacket.Chat(0, CSocket.Client.Name, To, Message, Type));
                                    }
                       
                            break;
                        }
10. Next GS>Database>Database.cs look for:

Code:
Client.Vitality = Convert.ToInt32(DR["Vit"]);
In GetCharacter void and add after it:
Code:
                //Guild
                Client.gid = Convert.ToUInt16(DR["Guild"]);
                Client.gpo = Convert.ToInt32(DR["GRank"]);
                Client.donation = Convert.ToInt32(DR["GDonation"]);

                if (Client.gid != 0 && Nano.Guilds.ContainsKey(Client.gid))
                {
                    if (Nano.Guilds[Client.gid].Leader.ID != Client.ID)
                    {
                        if (Nano.Guilds[Client.gid].Members.ContainsKey(Client.ID))
                        {
                            Nano.Guilds[Client.gid].Members[Client.ID].Donation = Client.donation;
                            Client.gna = Nano.Guilds[Client.gid].Name;
                            Client.InGuild = true;
                            if (Nano.Guilds[Client.gid].Members[Client.ID].isDL)
                            {
                                Client.gpo = 90;
                            }
                            else
                            {
                                Client.gpo = 50;
                            }

                        }
                        else
                        {
                            Client.InGuild = false;
                            Client.gna = "";
                            Client.gpo = 50;
                            Client.gid = 0;
                        }
                    }
                    else
                    {
                        Nano.Guilds[Client.gid].Leader.Donation = Client.donation;
                        Client.InGuild = true;
                        Client.gna = Nano.Guilds[Client.gid].Name;
                    }
                }
                //
Still here search for:
Code:
		public static void DeleteGuild(int ID)
		{
			MySqlCommand Cmd = new MySqlCommand("DELETE FROM `guilds` Where `GuildID` = " + ID + "", DatabaseConnection.NewConnection());
			Cmd.ExecuteNonQuery();
			Cmd.Connection.Close();
			Cmd.Connection.Dispose();
			Cmd.Dispose();
		}
and replace it with:
Code:
        public static void LoadGuilds()
        {
            MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `guilds`", DatabaseConnection.NewConnection());
            MySqlDataReader DR = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
            MySqlCommand Cmd2 = new MySqlCommand("SELECT Level, CharId FROM `characters`", DatabaseConnection.NewConnection());
            MySqlDataReader DR2 = Cmd2.ExecuteReader(CommandBehavior.CloseConnection);
            Dictionary<int, int> ChLvl = new Dictionary<int, int>();
            while (DR2.Read())
            {
                int id = Convert.ToInt32(DR2["CharID"]);
                int lvl = Convert.ToInt32(DR2["Level"]);
                ChLvl.Add(id, lvl);

            }
            while (DR.Read())
            {
                Guild GD = new Guild();
                GD.ID = Convert.ToUInt16(DR["GuildID"]);
                GD.Name = Convert.ToString(DR["Name"]);
                GD.Bulletin = Convert.ToString(DR["Bulletin"]);
                GD.Fund = Convert.ToInt32(DR["Fund"]);
                member Gl = new member();
                string tmp = Convert.ToString(DR["Leader"]);
                string[] ld = tmp.Split(':');
                Gl.ID = int.Parse(ld[0]); Gl.Name = ld[1];
                Gl.lvl = ChLvl[Gl.ID];
                GD.Leader = Gl;
                GD.MembersCount = 1;

                tmp = Convert.ToString(DR["Members"]);
                if (tmp != "")
                {
                    string[] mbs = tmp.Split('~');
                    foreach (string mbr in mbs)
                    {
                        member m = new member();
                        string[] mb = mbr.Split(':');
                        m.ID = int.Parse(mb[0]);
                        m.Name = mb[1];
                        if (mb[2] == "t")
                            m.isDL = true;
                        m.lvl = ChLvl[m.ID];
                        GD.Members.Add(m.ID, m);
                        GD.MembersCount++;
                    }
                }

                if (!Nano.Guilds.ContainsKey(GD.ID))
                {
                    Nano.Guilds.Add(GD.ID, GD);
                }


            }
            Console.WriteLine("[GameServer] Loaded " + Nano.Guilds.Count + " guilds from the DB.");
            DR.Close();
            Cmd.Dispose();
            DR2.Close();
            Cmd2.Dispose();
        }

        public static void NewGuild(Guild GD,Character Creator)
        {
            MySqlCommand Cmd = new MySqlCommand("INSERT INTO guilds(GuildID, Name, Bulletin, Fund, Leader) VALUES(" + GD.ID + ",'" + GD.Name + "','" + GD.Bulletin + "', 1000000,'" + GD.Leader.ID+":"+GD.Leader.Name + "')", DatabaseConnection.NewConnection());
            Cmd.ExecuteNonQuery();
            Cmd.Connection.Close();
            Cmd.Connection.Dispose();
            Cmd.Dispose();
            Cmd = new MySqlCommand("UPDATE `characters` SET `GDonation` = " + Creator.donation + ", `Guild` = " + GD.ID + ", `GRank` = 100 WHERE `CharID` = " + Creator.ID , DatabaseConnection.NewConnection());
            Cmd.ExecuteNonQuery();
            Cmd.Connection.Close();
            Cmd.Connection.Dispose();
            Cmd.Dispose();
        }
        public static void UpdateGuild(Guild GD)
        {
            MySqlCommand Cmd;
            string packmemb = "";
            bool first = true;
            foreach (KeyValuePair<int, member> m in GD.Members)
            {
                int rank = 50;
                string rank2="f";
                if (m.Value.isDL){
                    rank = 90;
                    rank2="t";
                }
                Cmd = new MySqlCommand("UPDATE `characters` SET `GDonation` = " + m.Value.Donation + ", `Guild` = " + GD.ID + ", `GRank` = "+rank+" WHERE `CharID` = " + m.Value.ID, DatabaseConnection.NewConnection());
                Cmd.ExecuteNonQuery();
                Cmd.Connection.Close();
                Cmd.Connection.Dispose();
                Cmd.Dispose();
                if (first)
                {
                    packmemb = m.Value.ID + ":" + m.Value.Name + ":" + rank2;
                    first = false;
                }
                else
                    packmemb += "~" + m.Value.ID + ":" + m.Value.Name + ":" + rank2;
                
            }
            Cmd = new MySqlCommand("UPDATE `characters` SET `GDonation` = " + GD.Leader.Donation + ", `Guild` = " + GD.ID + ", `GRank` = 100 WHERE `CharID` = " + GD.Leader.ID, DatabaseConnection.NewConnection());
            Cmd.ExecuteNonQuery();
            Cmd.Connection.Close();
            Cmd.Connection.Dispose();
            Cmd.Dispose();
            Cmd = new MySqlCommand("UPDATE `guilds` SET `Bulletin` = '" + GD.Bulletin + "', `Fund` = " + GD.Fund + ", `Members` = '" + packmemb + "', `Leader` = '" + GD.Leader.ID + ":" + GD.Leader.Name + "' WHERE `GuildID` = " + GD.ID, DatabaseConnection.NewConnection());
            Cmd.ExecuteNonQuery();
            Cmd.Connection.Close();
            Cmd.Connection.Dispose();
            Cmd.Dispose();
        }
		public static void DeleteGuild(int ID)
		{
            MySqlCommand Cmd = new MySqlCommand("DELETE FROM `guilds` Where `GuildID` = " + ID, DatabaseConnection.NewConnection());
			Cmd.ExecuteNonQuery();
			Cmd.Connection.Close();
			Cmd.Connection.Dispose();
			Cmd.Dispose();
            Cmd = new MySqlCommand("UPDATE `characters` SET `GDonation` = 0, `Guild` = 0, `GRank` = 50 WHERE `CharID` = " + Nano.Guilds[ID].Leader.ID, DatabaseConnection.NewConnection());
            Cmd.ExecuteNonQuery();
            Cmd.Connection.Close();
            Cmd.Connection.Dispose();
            Cmd.Dispose();
		}
11. Open Up GS>Packets>SpawnCharacter.cs and replace
Code:
			Packet.Short(0); //TODO: Guilds
			Packet.Int(0); //Unknown
			Packet.Int(0); //GuildRank
with :

Code:
			Packet.Short(CSocket.Client.gid); //TODO: Guilds
			Packet.Int(0); //Unknown
			Packet.Int(CSocket.Client.gpo); //GuildRank
12. Open GS>Nano.cs find StartServer() void and after Struct.LoadTNpcs(); add:

Code:
Database.Database.LoadGuilds();
13. Go To GS>Handlers>NPCTalk.cs and look for:
Code:
public static void NpcTalk(ClientSocket CSocket, int ID, int LinkBack)
replace it with:

Code:
public static void NpcTalk(ClientSocket CSocket, int ID, int LinkBack,byte[] data)
look for:

Code:
using CoEmu_v2_GameServer.Calculations;
and addif you dont have already)

Code:
using CoEmu_v2_GameServer.Entities;
14. still NPCTalk.cs add that somewhere:

Code:
                case 10003: // Guild Controler
                    {
                        if (LinkBack == 0)
                        {
                            Text("I am in charge of all the guilds in TwinCity, You may consult me for anything related to the guilds.", CSocket);
                            Link("Create a Guild.", 1, CSocket);
                            Link("Deputize.", 2, CSocket);
                            Link("Remove from Office.", 7, CSocket);
                            Link("Disband.", 3, CSocket);
                            Link("No, thanks.", 255, CSocket);

                            End(CSocket);
                        }
                        else if (LinkBack == 1)
                        {
                            if (!CSocket.Client.InGuild)
                            {
                                Text("It will cost you 1,000,000 silvers, and you need to be level 95 at least.", CSocket);
                                Input(4, CSocket);
                                Link("No, thanks.", 255, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("Sorry. You in a Guild.", CSocket);
                                Link("Ahhh.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 2)
                        {
                            if (CSocket.Client.gpo == 100)
                            {
                                int dlcount = 0;
                                foreach (KeyValuePair<int, member> m in Nano.Guilds[CSocket.Client.gid].Members)
                                    if (m.Value.isDL)
                                        dlcount++;
                                if (dlcount < 6)
                                {
                                    Text("Enter the name of your guildmate you want to deputize.", CSocket);
                                    Input(5, CSocket);
                                    Link("No, thanks.", 255, CSocket);
                                    End(CSocket);
                                }
                                else
                                {
                                    Text("Sorry. Your guild already have 6 DLs", CSocket);
                                    Link("Ahhh.", 255, CSocket);
                                    End(CSocket);
                                }
                            }
                            else
                            {
                                Text("Sorry. Only GuildLeader can promote members.", CSocket);
                                Link("Ahhh.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 3)
                        {
                            if (CSocket.Client.gpo == 100)
                            {
                                if (Nano.Guilds[CSocket.Client.gid].Members.Count == 0)
                                {
                                    Text("Are you sure you want to disband your guild?", CSocket);
                                    Link("Yes.", 6, CSocket);
                                    Link("No, actually.", 255, CSocket);
                                    End(CSocket);
                                }
                                else
                                {
                                    Text("You Cant Disband your guild until you have members in.", CSocket);
                                    Link("OK.", 255, CSocket);
                                    End(CSocket);
                                }
                            }
                            else
                            {
                                Text("Only guild leader can disband his/her guild.", CSocket);
                                Link("Ok.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 4)
                        {


                            if (!CSocket.Client.InGuild)
                            {
                                if (CSocket.Client.Money >= 1000000)
                                {
                                    if (CSocket.Client.Level >= 95)
                                    {
                                        string str = "";
                                        for (int i = 14; i < 14 + data[13]; i++)
                                        {
                                            str += Convert.ToChar(data[i]);
                                        }
                                        bool chk = true;
                                        foreach (KeyValuePair<int, Guild> gd in Nano.Guilds)
                                        {
                                            if (gd.Value.Name == str)
                                                chk = false;
                                        }
                                        if (chk)
                                        {
                                            int ngid;
                                            do
                                            {
                                                ngid = Nano.Rand.Next(100, 33333);
                                            } while (Nano.Guilds.ContainsKey(ngid));

                                            Money(-1000000, CSocket);
                                            Guild GD = new Guild();
                                            GD.Bulletin = "Enter Bulletin Here";
                                            GD.Fund = 1000000;
                                            GD.ID = (ushort)ngid;
                                            GD.Leader = new member();
                                            GD.Leader.ID = CSocket.Client.ID;
                                            GD.Leader.lvl = CSocket.Client.Level;
                                            GD.Leader.Name = CSocket.Client.Name;
                                            GD.Name = str;
                                            GD.MembersCount++;
                                            Nano.Guilds.Add(ngid, GD);
                                            CSocket.Client.gid = GD.ID;
                                            CSocket.Client.gna = str;
                                            CSocket.Client.gpo = 100;
                                            CSocket.Client.InGuild = true;
                                            Guild.refresh(CSocket);
                                            foreach (KeyValuePair<int, ClientSocket> C in Nano.ClientPool)
                                                C.Value.Send(ConquerPacket.Chat(0, "SYSTEM", "ALL", "Congratulations " + CSocket.Client.Name + " has set up " + str + " successfully!", Struct.ChatType.Talk));
                                            Database.Database.NewGuild(GD, CSocket.Client);
                                        }
                                        else
                                            Text("Guild name are taken.", CSocket);
                                        Link("OK.", 255, CSocket);
                                        End(CSocket);
                                        break;

                                    }
                                    else
                                        Text("You aren't high level enough.", CSocket);
                                    Link("OK.", 255, CSocket);
                                    End(CSocket);
                                    break;

                                }
                                Text("You don't have enough silvers.", CSocket);
                                Link("OK.", 255, CSocket);
                                End(CSocket);
                                break;
                            }
                            Text("Congratulations You have set up a guild.", CSocket);
                            Link("OK.", 255, CSocket);
                            End(CSocket);
                            break;
                        }
                        else if (LinkBack == 5)
                        {
                            string str = "";
                            for (int i = 14; i < 14 + data[13]; i++)
                            {
                                str += Convert.ToChar(data[i]);
                            }
                            bool t = false;
                            foreach (KeyValuePair<int, member> m in Nano.Guilds[CSocket.Client.gid].Members)
                                if (m.Value.Name == str)
                                {
                                    t = true;
                                    m.Value.isDL = true;
                                    if (Nano.ClientPool.ContainsKey(m.Key))
                                    {
                                        Nano.ClientPool[m.Value.ID].Client.gpo = 90;
                                        Guild.refresh(Nano.ClientPool[m.Value.ID]);
                                        Spawn.All(CSocket);
                                        break;
                                    }
                                    else
                                    {
                                        Text("The player you want to deputize must be in your guild and online.", CSocket);
                                        Link("OK.", 255, CSocket);
                                        End(CSocket);
                                        break;
                                    }
                                }
                            if (!t)
                            {
                                Text("You do not have that member.", CSocket);
                                Link("OK.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 6)
                        {
                            foreach (KeyValuePair<int, ClientSocket> C in Nano.ClientPool)
                                C.Value.Send(ConquerPacket.Chat(0, "SYSTEM", "ALL", CSocket.Client.gna + " has been disbanded.", Struct.ChatType.Talk));
                            Database.Database.DeleteGuild(CSocket.Client.gid);
                            CSocket.Send(ConquerPacket.GSend(CSocket.Client.gid, 19));
                            CSocket.Client.gid = 0;
                            CSocket.Client.gna = "";
                            CSocket.Client.gpo = 50;
                            Nano.Guilds.Remove(CSocket.Client.gid);

                        }
                        else if (LinkBack == 7)
                        {
                            if (CSocket.Client.gpo == 100)
                            {   
                                
                                    Text("Enter the name of your guildmate with you want remove from office.", CSocket);
                                    Input(8, CSocket);
                                    Link("No, thanks.", 255, CSocket);
                                    End(CSocket);
                                                            }
                            else
                            {
                                Text("Sorry. Only GuildLeader can remove DLs.", CSocket);
                                Link("Ahhh.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 8)
                        {
                            string str = "";
                            for (int i = 14; i < 14 + data[13]; i++)
                            {
                                str += Convert.ToChar(data[i]);
                            }
                            bool t = false;
                            foreach (KeyValuePair<int, member> m in Nano.Guilds[CSocket.Client.gid].Members)
                                if (m.Value.Name == str)
                                {
                                    t = true;
                                    m.Value.isDL = false;
                                    if (Nano.ClientPool.ContainsKey(m.Key))
                                    {
                                        Nano.ClientPool[m.Value.ID].Client.gpo = 50;
                                        Guild.refresh(Nano.ClientPool[m.Value.ID]);
                                        Spawn.All(CSocket);
                                        break;
                                    }
                                    else
                                    {
                                        Text("The player you want to remove DL must be online.", CSocket);
                                        Link("OK.", 255, CSocket);
                                        End(CSocket);
                                        break;
                                    }
                                }
                            if (!t)
                            {
                                Text("You do not have that member.", CSocket);
                                Link("OK.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        break;
                    }
15. In GS>PacketProcessor.cs search for:

Code:
case 2031: //Initial NPC talk
then replace:
Code:
					case 2031: //Initial NPC talk
						{
							int ID = ReadLong(Data, 4);
							Handler.NpcTalk(CSocket, ID, 0);
							break;
						}
					case 2032: //Reply NPC Talk
						{	
							int ID = CSocket.Client.LastNPC;
							int LinkBack = Data[10];
							if(LinkBack != 255)
								Handler.NpcTalk(CSocket, ID, LinkBack);
							break;
						}
with:

Code:
					case 2031: //Initial NPC talk
						{
							int ID = ReadLong(Data, 4);
							Handler.NpcTalk(CSocket, ID, 0,data);
							break;
						}
					case 2032: //Reply NPC Talk
						{	
							int ID = CSocket.Client.LastNPC;
							int LinkBack = Data[10];
							if(LinkBack != 255)
								Handler.NpcTalk(CSocket, ID, LinkBack,data);
							break;
						}
16. In GS>PacketProcessor.cs find:
Code:
					        	try
					        	{
					        		Monitor.Enter(Nano.ClientPool);
					        		Nano.ClientPool.Add(CSocket.Client.ID, CSocket);
and after it add:
Code:
                                    foreach (KeyValuePair<int, Guild> GD in Nano.Guilds)
                                        CSocket.Send(ConquerPacket.GName(GD.Value.ID, GD.Value.Name));
                                    Guild.refresh(CSocket);
                                    Spawn.MeTo(CSocket);
17. Last thing what you must do is edit your database. Find Members column under guilds tabble and change type to Text and allow null and Leader to vchar(26)you can execute that sql script in phpmyadmin to do it for you:

Code:
 ALTER TABLE `guilds` CHANGE `Members` `Members` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL 
 ALTER TABLE `guilds` CHANGE `Leader` `Leader` VARCHAR( 26 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL
Its all(for now). I hope You will like it.
bisiol is offline  
Thanks
2 Users
Old 08/16/2009, 06:34   #2
 
xellios's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 310
Received Thanks: 13
Rarely this came so fast out after alex source got releaed huh..
xellios is offline  
Old 08/16/2009, 06:43   #3
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
Quote:
Originally Posted by xellios View Post
Rarely this came so fast out after alex source got releaed huh..
What you mean?
bisiol is offline  
Old 08/16/2009, 10:33   #4
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
To add Enemy/Ally guilds:

1. Under GS>Entities>Guild.cs replace whole

Code:
        public static void refresh(ClientSocket CSocket)
with:

Code:
        public static void refresh(ClientSocket CSocket)
        {
            if (CSocket.Client.InGuild && Nano.Guilds.ContainsKey(CSocket.Client.gid))
            {
                Guild gd = Nano.Guilds[CSocket.Client.gid];
                CSocket.Send(ConquerPacket.GName(CSocket.Client.gid, CSocket.Client.gna));
                CSocket.Send(ConquerPacket.Ginfo(gd, CSocket.Client));
                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, gd.Bulletin, Struct.ChatType.GuildBulletin));
               foreach(int e in Nano.Guilds[CSocket.Client.gid].Enemy)
                CSocket.Send(ConquerPacket.GSend(e,9));
               foreach (int a in Nano.Guilds[CSocket.Client.gid].Allies)
                   CSocket.Send(ConquerPacket.GSend(a, 7));
               
            }
        }
2. Open GS>Database>Database.cs
Under public static void LoadGuilds() look for:
Code:
                if (!Nano.Guilds.ContainsKey(GD.ID))
                {
                    Nano.Guilds.Add(GD.ID, GD);
                }
and before it add:
Code:
                tmp = Convert.ToString(DR["Enemies"]);
                if (tmp != "")
                {
                    string[] AllEn = tmp.Split(':');
                    foreach(string e in AllEn)
                    GD.Enemy.Add(int.Parse(e));
                }
                tmp = "";
                tmp = Convert.ToString(DR["Allies"]);
                if (tmp != "")
                {
                    string[] AllEn = tmp.Split(':');
                    foreach (string a in AllEn)
                        if (!GD.Enemy.Contains(int.Parse(a)))
                        GD.Allies.Add(int.Parse(a));
                }
Under
Code:
public static void UpdateGuild(Guild GD)
look for:
Code:
            Cmd = new MySqlCommand("UPDATE `guilds` SET `Bulletin` = '" + GD.Bulletin + "', `Fund` = " + GD.Fund + ", `Members` = '" + packmemb + "', `Leader` = '" + GD.Leader.ID + ":" + GD.Leader.Name + "' WHERE `GuildID` = " + GD.ID, DatabaseConnection.NewConnection());
and replace it with:
Code:
            string packEnemy = "", packAlly = "";
            first = true;
            foreach (int e in GD.Enemy)
                if (first)
                {
                    packEnemy = e.ToString();
                    first = false;
                }
                else
                    packEnemy += ":" + e.ToString();

            first = true;
            foreach (int a in GD.Allies)
                if(!GD.Enemy.Contains(a))
                if (first)
                {
                    packAlly = a.ToString();
                    first = false;
                }
                else
                    packAlly += ":" + a.ToString();

            Cmd = new MySqlCommand("UPDATE `guilds` SET `Bulletin` = '" + GD.Bulletin + "', `Fund` = " + GD.Fund + ", `Members` = '" + packmemb + "', `Enemies` = '" + packEnemy + "', `Allies` = '" + packAlly + "', `Leader` = '" + GD.Leader.ID + ":" + GD.Leader.Name + "' WHERE `GuildID` = " + GD.ID, DatabaseConnection.NewConnection());
3. Go to GS>Handlers>NPCTalk.cs
search for:
Code:
                case 10003: // Guild Controler
                    {
                        if (LinkBack == 0)
                        {
                            Text("I am in charge of all the guilds in TwinCity, You may consult me for anything related to the guilds.", CSocket);
                            Link("Create a Guild.", 1, CSocket);
                            Link("Deputize.", 2, CSocket);
                            Link("Remove from Office.", 7, CSocket);
                            Link("Disband.", 3, CSocket);
                            Link("No, thanks.", 255, CSocket);

                            End(CSocket);
                        }
and replace it with:
Code:
                case 10003: // Guild Controler
                    {
                        if (LinkBack == 0)
                        {
                            Text("I am in charge of all the guilds in TwinCity, You may consult me for anything related to the guilds.", CSocket);
                            Link("Create a Guild.", 1, CSocket);
                            Link("Deputize.", 2, CSocket);
                            Link("Remove from Office.", 7, CSocket);
                            Link("Disband.", 3, CSocket);
                            Link("More.", 9, CSocket);
                            Link("No, thanks.", 255, CSocket);

                            End(CSocket);
                        }
 if (LinkBack == 9)
                        {
                            Text("I am in charge of all the guilds in TwinCity, You may consult me for anything related to the guilds.", CSocket);
                            Link("Make Allay.", 10, CSocket);
                            Link("Make Enemy.", 14, CSocket);
                            Link("Cancel Allay.", 12, CSocket);
                            Link("Cancel Enemy.", 16, CSocket);
                            Link("Back.", 0, CSocket);
                            Link("No, thanks.", 255, CSocket);

                            End(CSocket);
                        }
                        else if (LinkBack == 10)
                        {
                            if (CSocket.Client.gpo==100)
                            {
                                Text("Team Up with other Guild Leader and Press OK when ready.", CSocket);
                                Link("OK.", 11, CSocket);
                                Link("No, thanks.", 255, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("Sorry. Only Guild Leader can make alliance.", CSocket);
                                Link("Ahhh.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 11)
                        {
                            if (CSocket.Client.gpo == 100)
                            {
                                if(CSocket.Client.Team!=null&&CSocket.Client.Team.Members.Count>=2)
                                    foreach(KeyValuePair<int,ClientSocket> OL in CSocket.Client.Team.Members)
                                        if(OL.Value.Client.gpo==100&&OL.Value.Client.ID!=CSocket.Client.ID)
                                            if(Nano.Guilds[CSocket.Client.gid].Allies.Count<5&&Nano.Guilds[OL.Value.Client.gid].Allies.Count<5)
                                                if (!Nano.Guilds[CSocket.Client.gid].Allies.Contains(OL.Value.Client.gid) && !Nano.Guilds[OL.Value.Client.gid].Allies.Contains(CSocket.Client.gid))
                                                {
                                                    Nano.Guilds[CSocket.Client.gid].Allies.Add((int)OL.Value.Client.gid);
                                                    Nano.Guilds[OL.Value.Client.gid].Allies.Add((int)CSocket.Client.gid);
                                                    if (Nano.Guilds[CSocket.Client.gid].Enemy.Contains(OL.Value.Client.gid))
                                                        Nano.Guilds[CSocket.Client.gid].Enemy.Remove(OL.Value.Client.gid);
                                                    if (Nano.Guilds[OL.Value.Client.gid].Enemy.Contains(CSocket.Client.gid))
                                                        Nano.Guilds[OL.Value.Client.gid].Enemy.Remove(CSocket.Client.gid);
                                                    Database.Database.UpdateGuild(Nano.Guilds[CSocket.Client.gid]);
                                                    Database.Database.UpdateGuild(Nano.Guilds[OL.Value.Client.gid]);
                                                    foreach (KeyValuePair<int, ClientSocket> cs in Nano.ClientPool)
                                                    {
                                                        if (cs.Value.Client.gid == OL.Value.Client.gid && Nano.ClientPool.ContainsKey(cs.Value.Client.ID))
                                                        {
                                                            cs.Value.Send(ConquerPacket.GSend(CSocket.Client.gid, 7));
                                                            Guild.refresh(cs.Value);
                                                        }
                                                        if (cs.Value.Client.gid == CSocket.Client.gid && Nano.ClientPool.ContainsKey(cs.Value.Client.ID))
                                                        {
                                                            cs.Value.Send(ConquerPacket.GSend(OL.Value.Client.gid, 7));
                                                            Guild.refresh(cs.Value);
                                                        }
                                                    }
                                                }
                               
                            }
                        }
                        else if (LinkBack == 12)
                        {
                            if (CSocket.Client.gpo == 100)
                            {

                                Text("Enter guildname with you want cancel alliance.", CSocket);
                                Input(13, CSocket);
                                Link("No, thanks.", 255, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("Sorry. Only GuildLeader can cancel alliance.", CSocket);
                                Link("Ahhh.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 13)
                        {
                            string str = "";
                            for (int i = 14; i < 14 + data[13]; i++)
                            {
                                str += Convert.ToChar(data[i]);
                            }
                            int id = 0;
                            foreach (KeyValuePair<int, Guild> gd in Nano.Guilds)
                                if (gd.Value.Name == str)
                                {
                                    id = gd.Value.ID;

                                    if (Nano.Guilds[CSocket.Client.gid].Allies.Contains(id))
                                        Nano.Guilds[CSocket.Client.gid].Allies.Remove(id);
                                    if (Nano.Guilds[id].Allies.Contains(CSocket.Client.gid))
                                        Nano.Guilds[id].Allies.Remove(CSocket.Client.gid);

                                    Database.Database.UpdateGuild(Nano.Guilds[CSocket.Client.gid]);
                                    Database.Database.UpdateGuild(Nano.Guilds[id]);
                                    CSocket.Send(ConquerPacket.GSend(id, 8));
                                    Guild.refresh(CSocket);
                                    foreach (KeyValuePair<int, ClientSocket> cs in Nano.ClientPool)
                                    {
                                        if (cs.Value.Client.gid == id&&Nano.ClientPool.ContainsKey(cs.Value.Client.ID))
                                        {
                                            cs.Value.Send(ConquerPacket.GSend(CSocket.Client.gid, 8));
                                            Guild.refresh(cs.Value);
                                        }
                                        if (cs.Value.Client.gid == CSocket.Client.gid && Nano.ClientPool.ContainsKey(cs.Value.Client.ID))
                                        {
                                            cs.Value.Send(ConquerPacket.GSend(id, 8));
                                            Guild.refresh(cs.Value);
                                        }
                                    }
                                }
                        }
                        else if (LinkBack == 14)
                        {
                            if (CSocket.Client.gpo == 100)
                            {

                                Text("Enter guildname with you want to make enemy.", CSocket);
                                Input(15, CSocket);
                                Link("No, thanks.", 255, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("Sorry. Only GuildLeader can make enemy guild.", CSocket);
                                Link("Ahhh.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 15)
                        {
                            string str = "";
                            for (int i = 14; i < 14 + data[13]; i++)
                            {
                                str += Convert.ToChar(data[i]);
                            }
                            int id = 0;
                            foreach (KeyValuePair<int, Guild> gd in Nano.Guilds)
                                if (gd.Value.Name == str)
                                {
                                    id = gd.Value.ID;

                                    if (Nano.Guilds[CSocket.Client.gid].Allies.Contains(id))
                                        Nano.Guilds[CSocket.Client.gid].Allies.Remove(id);
                                    if (Nano.Guilds[id].Allies.Contains(CSocket.Client.gid))
                                        Nano.Guilds[id].Allies.Remove(CSocket.Client.gid);
                                    Nano.Guilds[CSocket.Client.gid].Enemy.Add(id);
                                    Database.Database.UpdateGuild(Nano.Guilds[CSocket.Client.gid]);
                                    Database.Database.UpdateGuild(Nano.Guilds[id]);
                                    CSocket.Send(ConquerPacket.GSend(id, 9));
                                    Guild.refresh(CSocket);
                                    foreach (KeyValuePair<int, ClientSocket> cs in Nano.ClientPool)
                                    {
                                        if (cs.Value.Client.gid == id && Nano.ClientPool.ContainsKey(cs.Value.Client.ID))
                                        {
                                            cs.Value.Send(ConquerPacket.GSend(CSocket.Client.gid, 8));
                                            Guild.refresh(cs.Value);
                                        }
                                        if (cs.Value.Client.gid == CSocket.Client.gid && Nano.ClientPool.ContainsKey(cs.Value.Client.ID))
                                        {
                                            cs.Value.Send(ConquerPacket.GSend(id, 9));
                                            Guild.refresh(cs.Value);
                                        }
                                    }
                                }
                        }
                        else if (LinkBack == 16)
                        {
                            if (CSocket.Client.gpo == 100)
                            {

                                Text("Enter guildname with you want cancel enemy.", CSocket);
                                Input(17, CSocket);
                                Link("No, thanks.", 255, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("Sorry. Only GuildLeader can cancel alliance.", CSocket);
                                Link("Ahhh.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 17)
                        {
                            string str = "";
                            for (int i = 14; i < 14 + data[13]; i++)
                            {
                                str += Convert.ToChar(data[i]);
                            }
                            int id = 0;
                            foreach (KeyValuePair<int, Guild> gd in Nano.Guilds)
                                if (gd.Value.Name == str)
                                {
                                    id = gd.Value.ID;

                                    if (Nano.Guilds[CSocket.Client.gid].Enemy.Contains(id))
                                        Nano.Guilds[CSocket.Client.gid].Enemy.Remove(id);

                                    Database.Database.UpdateGuild(Nano.Guilds[CSocket.Client.gid]);
                                    CSocket.Send(ConquerPacket.GSend(id, 8));
                                    Guild.refresh(CSocket);
                                    foreach (KeyValuePair<int, ClientSocket> cs in Nano.ClientPool)
                                    {   if (cs.Value.Client.gid == CSocket.Client.gid && Nano.ClientPool.ContainsKey(cs.Value.Client.ID))
                                        {
                                            cs.Value.Send(ConquerPacket.GSend(id, 8));
                                            Guild.refresh(cs.Value);
                                        }
                                    }
                                }
                        }
In Entities>Guild.cs after
Code:
        public string Bulletin; //Bulletin

add:

Code:
        public List<int> Allies = new List<int>();
        public List<int> Enemy = new List<int>();
bisiol is offline  
Old 08/16/2009, 11:40   #5
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 773
Received Thanks: 441
there missing somethings...
12tails is offline  
Old 08/16/2009, 11:46   #6
 
elite*gold: 0
Join Date: Jul 2009
Posts: 548
Received Thanks: 52
:O i can translate this
f0am is offline  
Old 08/16/2009, 12:35   #7

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
Quote:
Originally Posted by xellios View Post
Rarely this came so fast out after alex source got releaed huh..
Actually I think that this isn't from Alex's source.
Kiyono is offline  
Old 08/16/2009, 12:39   #8
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
Quote:
Originally Posted by Kiyono View Post
Actually I think that this isn't from Alex's source.
Its my code.
bisiol is offline  
Old 08/16/2009, 12:40   #9
 
xellios's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 310
Received Thanks: 13
The definitions can be changed.. its easy to do it.
xellios is offline  
Old 08/16/2009, 13:39   #10

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
Quote:
Originally Posted by xellios View Post
The definitions can be changed.. its easy to do it.
The code is completely different.
Kiyono is offline  
Old 08/16/2009, 14:20   #11
 
elite*gold: 0
Join Date: Aug 2008
Posts: 5
Received Thanks: 0
err

err look
Attached Images
File Type: jpg err.jpg (23.2 KB, 30 views)
haryne is offline  
Old 08/16/2009, 14:26   #12

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
Quote:
Originally Posted by haryne View Post
err look
Too small.
Kiyono is offline  
Old 08/16/2009, 14:55   #13
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 773
Received Thanks: 441
he got the same error as me....

he forgot to post the definitions for Enemy and ally.... but i tryied to make my self whith strings... and others but does not work... i don't know what type of definitions he make... i think i will need to make something more specifyc...

(sorry for bad english haha)
12tails is offline  
Old 08/16/2009, 15:21   #14
 
bisiol's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 44
Received Thanks: 69
Quote:
Originally Posted by 12tails View Post
he got the same error as me....

he forgot to post the definitions for Enemy and ally.... but i tryied to make my self whith strings... and others but does not work... i don't know what type of definitions he make... i think i will need to make something more specifyc...

(sorry for bad english haha)
Sorry for that.
In Entities>Guild.cs after
Code:
        public string Bulletin; //Bulletin

add:

Code:
        public List<int> Allies = new List<int>();
        public List<int> Enemy = new List<int>();
bisiol is offline  
Thanks
1 User
Old 08/16/2009, 16:05   #15
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 773
Received Thanks: 441
thankx for it ^^

and put it into you first post to become more complete ^^
12tails is offline  
Reply


Similar Threads Similar Threads
Guilds-Recruiting Thread (Join/Announce Guilds Here!!)
07/13/2011 - Silkroad Online - 95 Replies
Guilds-Recruiting === ===== ======= ========= =========== =============
[HELP] with Guilds
06/11/2010 - Shaiya - 6 Replies
Ok guilds dont store in database. We can make a guild in game. but it doesnt store in database and it doesnt store the guildchars either. When we restart server it disappears. yes i have tried the forums and ran the sql scripts that are release but still didnt fix problem SO im asking if anyone know why this is happening.
Guilds
05/26/2010 - Shaiya Private Server - 2 Replies
Ok just a quick question i had jus re-released my Shaiya Private server and i had noticed in game that there were numerous guilds i went an looked in the database an the guilds were not registered in the database how can i go about fixing that so i can actually see that and kno that if i were to restart the server it doesnt delete the guilds



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


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.