Delete the bracket under break;
You have 2 brackets under it, where ur only supposed to have 1 :)
You have 2 brackets under it, where ur only supposed to have 1 :)
add me on msn I will help you out over TV if you have it.Quote:
Agreed but now I get "} expected" error along with 301 more errors and all because of that dumb } lol. By the way it works on my NPC that I created but it just won`t work for the guild NPC >.<
Yeah I am a Brit and yeah I will be on for most of the night... well until about 2 maybe 3 soo I will talk to you a bit laterQuote:
I don`t have TV on this comp yet I had it for my laptop but haven`t got around to putting it on here lol. Well it`s not to important yet but I will take you up on that offer :) For now I should really get my head down. Been far to busy again through the night and had headache earlier so took a headache pill and carried on but I really should get some sleep.
I assume .Beatz you`re a Brit like me? If so will you be awake through the night? I`m a night creature rather than a day creature lol.
#region Guild NPC allied&enemied
case 19999:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("I am what my name says. I create and manage guilds. So what do you want to do?"));
GC.AddSend(Packets.NPCLink("Create Allies", 1));
GC.AddSend(Packets.NPCLink("Create Enemies", 3));
GC.AddSend(Packets.NPCLink("Just passing by.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
#region Ally
if (Control == 1)
{
GC.AddSend(Packets.NPCSay("Who would you like to Ally?"));
GC.AddSend(Packets.NPCLink2("Ally", 21));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 21)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
string Ally = ReadString(Data);
foreach (Features.Guild g in Features.Guilds.AllTheGuilds.Values)
{
if (g.GuildName == Ally)
{
if (g.Creator.Info != null)
{
if (g.Creator.Info.MyTeam.Members.Contains(GC.MyChar.EntityID))
{
if (!GC.MyChar.MyGuild.Allies.ContainsValue(Ally))
{
GC.MyChar.MyGuild.Allies.Add(0, Ally);
GC.AddSend(Packets.String(g.GuildID, 21, Ally));
GC.AddSend(Packets.NPCSay(g.GuildName + " is now your ally!"));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay(g.GuildName + " is already allied."));
GC.AddSend(Packets.NPCLink("Oh alright.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("Make sure the guild leader of the Features guild is in your team."));
GC.AddSend(Packets.NPCLink("Okay", 255));
}
}
}
}
break;
}
}
#endregion
#region Enemy
if (Control == 3)
{
GC.AddSend(Packets.NPCSay("Who would you like to Enemy?"));
GC.AddSend(Packets.NPCLink2("Enemy", 23));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 23)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
string Enemy = ReadString(Data);
foreach (Features.Guild g in Features.Guilds.AllTheGuilds.Values)
{
if (g.GuildName == Enemy)
{
if (g.Creator.Info != null)
{
if (!GC.MyChar.MyGuild.Enemies.ContainsValue(Enemy))
{
GC.MyChar.MyGuild.Enemies.Add(0, Enemy);
GC.AddSend(Packets.String(g.GuildID, 21, Enemy));
GC.AddSend(Packets.NPCSay(g.GuildName + " is now your enemy!"));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay(g.GuildName + " is already enemied."));
GC.AddSend(Packets.NPCLink("Oh alright.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("Make sure the guild leader of the Features guild is in your team."));
GC.AddSend(Packets.NPCLink("Okay", 255));
}
}
}
}
break;
}
#endregion
break;
}
#endregion
#region Guild NPC
case 10003:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("I am what my name says. I create and manage guilds. So what do you want to do?"));
GC.AddSend(Packets.NPCLink("Create Guild", 1));
GC.AddSend(Packets.NPCLink("Deputize", 3));
GC.AddSend(Packets.NPCLink("Disband my guild", 5));
//GC.AddSend(Packets.NPCLink("Allies", 7));
//GC.AddSend(Packets.NPCLink("Enemies", 9));
GC.AddSend(Packets.NPCLink("Just passing by.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
#region Create
else if (Control == 1)
{
if (GC.MyChar.MyGuild == null)
{
GC.AddSend(Packets.NPCSay("I don't know why, but you have to be level 95 or higher and need 1 million silvers to create one."));
GC.AddSend(Packets.NPCLink2("Create", 2));
GC.AddSend(Packets.NPCLink("No, i changed my mind.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("You are already in a guild. You cannot create a guild."));
GC.AddSend(Packets.NPCLink("Oh, i forgot...", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else if (Control == 2)
{
if (GC.MyChar.Level >= 95 && GC.MyChar.MyGuild == null)
{
if (GC.MyChar.Silvers >= 1000000)
{
string GuildName = ReadString(Data);
if (Features.Guilds.ValidName(GuildName))
{
GC.MyChar.Silvers -= 1000000;
ushort NewGuildID = (ushort)Rnd.Next(ushort.MaxValue);
while (Features.Guilds.AllTheGuilds.Contains(NewGuildID))
NewGuildID = (ushort)Rnd.Next(ushort.MaxValue);
Features.Guilds.CreateNewGuild(GuildName, NewGuildID, GC.MyChar);
Game.World.Spawn(GC.MyChar, false);
GC.AddSend(Packets.GuildInfo(GC.MyChar.MyGuild, GC.MyChar));
GC.AddSend(Packets.String(GC.MyChar.MyGuild.GuildID, (byte)Game.StringType.GuildName, GC.MyChar.MyGuild.GuildName));
GC.AddSend(Packets.NPCSay("Congratulations! You now have your own guild."));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("Choose another name, this name is taken or has invalid length."));
GC.AddSend(Packets.NPCLink2("Create", 2));
GC.AddSend(Packets.NPCLink("I changed my mind.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("I said you need 1 million silvers and you don't have enough."));
GC.AddSend(Packets.NPCLink("Ok ok, i'll go bring the money.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("Forget it! You're too weak."));
GC.AddSend(Packets.NPCLink("Alright, i will get stronger.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
#endregion
#region Deputize
else if (Control == 3)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
GC.AddSend(Packets.NPCSay("Insert the name of the player in your guild you want to make a deputy leader."));
GC.AddSend(Packets.NPCLink2("Here", 4));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("You are not a guild leader."));
GC.AddSend(Packets.NPCLink("Silly me.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else if (Control == 4)
{
string PlayerName = ReadString(Data);
Features.MemberInfo M = GC.MyChar.MyGuild.MembOfName(PlayerName);
if (M != null && M.MembName == PlayerName && ((Hashtable)GC.MyChar.MyGuild.Members[(byte)90]).Count < 5)
{
M.Rank = NewestCOServer.Features.GuildRank.DeputyManager;
((Hashtable)GC.MyChar.MyGuild.Members[(byte)50]).Remove(M.MembID);
((Hashtable)GC.MyChar.MyGuild.Members[(byte)90]).Add(M.MembID, M);
Game.Character C = M.Info;
if (C != null)
{
C.GuildRank = NewestCOServer.Features.GuildRank.DeputyManager;
Game.World.Spawn(C, false);
C.MyClient.AddSend(Packets.GuildInfo(GC.MyChar.MyGuild, GC.MyChar));
}
}
else
{
GC.AddSend(Packets.NPCSay("The player is not in your guild or is not a normal member. By the way, the max number deputy leaders there can be is 5."));
GC.AddSend(Packets.NPCLink("Oh, sorry.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
#endregion
#region Disband
else if (Control == 5)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
GC.AddSend(Packets.NPCSay("Are you sure you want to disband your guild?"));
GC.AddSend(Packets.NPCLink("Yes, i want to disband my guild.", 6));
GC.AddSend(Packets.NPCLink("I've changed my mind.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("You are not a guild leader, therefore you cannot disband a guild."));
GC.AddSend(Packets.NPCLink("I see.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else if (Control == 6)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
GC.MyChar.MyGuild.Disband();
}
#endregion
}
break;
}
#endregion
GC.MyChar.MyGuild.Enemies.Remove(0, Enemy);
Quote:
Ok well I had a few hours sleep and am back now :) I really want to try to work this one out for myself but will only resort to TV when I am on the floor in tears because it just won`t work rofl.
It doesn`t throw any errors at all it just doesn`t open the box for me to put text in >.< I know I have areas in GuildNPC that are // but that`s because I have taken the rest of the code back out.
Also what should this be? I want a remove enemy :D
I also tried using the part that arco placed on here several pages ago but I get an error >.<Code:GC.MyChar.MyGuild.Enemies.Remove(0, Enemy);
else if (Control == 30)
{
if (GC.Char.GuildRank == GuildRank.GuildLeader)
{
Text("What is the Guild you would like to remove as an enemy?.", GC);
Link2("Guild Name", 31, GC);
Link("Just passing by", 255, GC);
Face(30, GC);
End(GC);
}
else
{
NpcSendMessage("You're not the guild leader!", N, GC);
}
}
else if (Control == 61)
{
string name = ReadString(Data);
Guild Enemy = null;
#region read guild
foreach (Guild G in Game.GameGuilds.Values)
{
if (G != null)
{
if (G.ID != GC.Char.Guild.ID)
{
Enemy = G;
}
}
}
#endregion
case 2031:
{
GC.DialogNPC = BitConverter.ToUInt32(Data, 4);
PacketHandling.NPCDialog.Handle(GC, Data, GC.DialogNPC, 0);
break;
}
case 2032:
{
if (Data[10] != 0)
PacketHandling.NPCDialog.Handle(GC, Data, GC.DialogNPC, Data[10]);
else
{
byte NameLength = Data[13];
string Name = "";
for (byte i = 0; i < NameLength; i++)
Name += Convert.ToChar(Data[14 + i]);
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
GC.MyChar.MyGuild.MemberLeaves(Name, true);
}
break;
}
public static COPacket NPCLink2(string Text, byte DialNr)
{
byte[] Packet = new byte[8 + 17 + Text.Length];
COPacket P = new COPacket(Packet);
P.WriteInt16((ushort)(Packet.Length - 8));
P.WriteInt16((ushort)0x7f0);
P.Move(6);
P.WriteByte(DialNr);
P.WriteByte(0x03);
P.WriteByte(0x01);
P.WriteByte((byte)Text.Length);
P.WriteString(Text);
P.Move(3);
return P;
}
// #region Passing Leaderance
// else if (Control == 7)
// {
// if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
// {
// GC.AddSend(Packets.NPCSay("Who do you want to be the new Guild Leader?"));
// GC.AddSend(Packets.NPCLink2("Will be...", 8));
// GC.AddSend(Packets.NPCLink("Just passing by.", 255));
// Face(N.Avatar, GC);
// End(GC);
// }
// else
// {
// Text("You're not the guild leader!", GC);
// Link("I see", 255, GC);
// Face(N.Avatar, GC);
// End(GC);
// }
// }
// else if (Control == 8)
// {
// string NewLeader = ReadString(Data);
// Character Char = null;
// Guild G = GuildName[GC.MyChar.MyGuild.GuildID];
// if (NewLeader == GC.MyChar.Name)
// {
// Text("You can't pass the leadership to yourself!", GC);
// Link("I see", 255, GC);
// Face(N.Avatar, GC);
// End(GC);
// return;
// }
// foreach (Game.Character Target in World.H_Chars.Values)
// {
// if (Game.Character.Name == NewLeader)
// Char = Cli.Char;
// }
// if (Char != null)
// {
// if (G.Members.ContainsKey(Char.EntityID))
// {
// Features.MemberInfo M = NewestCOServer.Features.Guilds.ValidName[Char.EntityID];
// M.Rank = NewestCOServer.Features.GuildRank.GuildLeader;
// Char.GuildRank = NewestCOServer.Features.GuildRank.GuildLeader;
// GC.MyChar.GuildRank = NewestCOServer.Features.GuildRank.Member;
// Game.World.Spawn(Char, false);
// Char.MyClient.AddSend(Packets.GuildInfo(Char.MyGuild, Char));
// }
// else
// {
// Text("You don't have a member with that name or the member isn't online!", GC);
// Link("I see", 255, GC);
// Face(N.Avatar, GC);
// End(GC);
// return;
// }
// }
// else
// {
// Text("You don't have a member with that name or the member isn't online!", GC);
// Link("I see", 255, GC);
// Face(N.Avatar, GC);
// End(GC);
// return;
// }
// }
// #endregion
#region Enemy
else if (Control == 9)
{
if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
Text("Please, tell me the guild name.", GC);
GC.AddSend(Packets.NPCLink2("Guild Name", 50));
Link("Just passing by", 255, GC);
Face(N.Avatar, GC);
End(GC);
}
else
{
GC.AddSend(Packets.NPCSay("You're not the guild leader... Please leave me!"));
}
}
else if (Control == 50)
{
string name = ReadString(Data);
Guild Enemy = null;
#region read guild
foreach (Guild G in Game.GameGuilds.Values)
{
if (G != null)
{
if (G.ID != GC.Char.Guild.ID)
{
Enemy = G;
}
}
}
#endregion
if (Enemy == null)
{
GC.AddSend(Packets.NPCSay("Hmmm... This guild name is invalid, doesn't exist a guild with that name!"));
}
else
{
if (!GC.MyChar.MyGuild.Enemies.ContainsKey(Enemy.GuildID))
GC.MyChar.MyGuild.Enemies.Add(Enemy.GuildID, 0);
Database.NewEnemy(GC.MyChar.MyGuild.GuildID, Enemy.GuildID);
Game.World.Spawns(GC.MyChar, false);
}
}
else if (Control == 60)
{
if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
Text("Please, tell me the guild name.", GC);
GC.AddSend(Packets.NPCLink2("Guild Name", 61));
Link("Just passing by", 255, GC);
Face(N.Avatar, GC);
End(GC);
}
else
{
GC.AddSend(Packets.NPCSay("You're not the guild leader... Please leave me!"));
}
}
else if (Control == 61)
{
string name = ReadString(Data);
Guild Enemy = null;
#region read guild
foreach (Guild G in Game.GameGuilds.Values)
{
if (G != null)
{
if (G.ID != GC.Char.Guild.ID)
{
Enemy = G;
}
}
}
#endregion
if (Enemy == null)
{
GC.AddSend(Packets.NPCSay("Hmmm... This guild name is invalid, doesn't exist a guild with that name!"));
}
else
{
if (GC.MyChar.MyGuild.Enemies.ContainsKey(Enemy.GuildID))
{
GC.MyChar.MyGuild.Enemies.Remove(Enemy.GuildID);
Database.DeleteEnemy(GC.MyChar.MyGuild.GuildID, Enemy.GuildID);
}
Game.World.Spawns(GC.MyChar, false);
}
}
#endregion
#region Ally
else if (Control == 12)
{
if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
if (GC.MyChar.MyTeam != null && GC.MyChar.TeamLeader)
{
foreach (Character C in GC.MyChar.MyTeam.Members)
{
if (C.EntityID != GC.MyChar.EntityID)
{
if (Calculate.InBox(GC.MyChar.Loc.X, GC.MyChar.Loc.Y, C.Loc.X, C.Loc.Y, 15))
{
if (C.MyGuild != null && C.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
Guild my = GC.MyChar.Guild;
Guild ally = C.MyGuild;
if (!my.Allies.ContainsKey(ally.ID) && !ally.Allies.ContainsKey(my.GuildID))
{
try
{
my.Allies.Add(ally.ID, 0);
ally.Allies.Add(my.ID, 0);
}
catch { }
Database.NewAlly(my.ID, ally.ID);
Database.NewAlly(ally.ID, my.ID);
Actions.Spawns(GC.Char, false);
Actions.Spawns(C, false);
break;
}
else
{
GC.AddSend(Packets.NPCSay("This guild is already your ally!"));
}
}
}
}
}
}
else
{
GC.AddSend(Packets.NPCSay("Make a team first!"));
}
}
else
{
GC.AddSend(Packets.NPCSay("You're not the guild leader... Please leave me!"));
}
}
else if (Control == 62)
{
if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
Text("Please, tell me the guild name.", GC);
GC.AddSend(Packets.NPCLink2("Guild Name", 63));
Link("Just passing by", 255, GC);
Face(N.Avatar, GC);
End(GC);
}
else
{
GC.AddSend(Packets.NPCSay("You're not the guild leader... Please leave me!"));
}
}
else if (Control == 63)
{
string name = ReadString(Data);
Guild Ally = null;
#region read guild
foreach (Guild G in Game.GameGuilds.Values)
{
if (G != null)
{
if (G.ID != GC.Char.Guild.ID)
{
Ally = G;
}
}
}
#endregion
if (Ally == null)
{
GC.AddSend(Packets.NPCSay("Hmmm... This guild name is invalid, doesn't exist a guild with that name!"));
}
else
{
if (GC.MyChar.MyGuild.Allies.ContainsKey(Ally.GuildID))
{
GC.MyChar.MyGuild.Allies.Remove(Ally.GuildID);
Database.DeleteAlly(GC.MyChar.MyGuild.GuildID, Ally.GuildID);
}
Game.World.Spawns(GC.MyChar, false);
}
}
#endregion
else if (Control == 13)
{
Text("I am what my name says. I help create and manage guilds. So what do you want to do?", GC);
Link("Ally to a guild", 12, GC);
Link("Remove Ally", 62, GC);
Link("Enemy to a guild", 9, GC);
Link("Remove Enemy", 60, GC);
Link("Just passing by", 255, GC);
Face(N.Avatar, GC);
End(GC);
}
break;
}
#endregion
I am laughing at you...Just for the shear fact that I am completely lost now aha, so you have converted what you can?Quote:
Thank you I will give it a whirl :) Ok I have converted what I could but for some of it I am lost or have confused myself >.<
I`m sure there are probably some people laughing at me but meh lolCode:// #region Passing Leaderance // else if (Control == 7) // { // if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader) // { // GC.AddSend(Packets.NPCSay("Who do you want to be the new Guild Leader?")); // GC.AddSend(Packets.NPCLink2("Will be...", 8)); // GC.AddSend(Packets.NPCLink("Just passing by.", 255)); // Face(N.Avatar, GC); // End(GC); // } // else // { // Text("You're not the guild leader!", GC); // Link("I see", 255, GC); // Face(N.Avatar, GC); // End(GC); // } // } // else if (Control == 8) // { // string NewLeader = ReadString(Data); // Character Char = null; // Guild G = GuildName[GC.MyChar.MyGuild.GuildID]; // if (NewLeader == GC.MyChar.Name) // { // Text("You can't pass the leadership to yourself!", GC); // Link("I see", 255, GC); // Face(N.Avatar, GC); // End(GC); // return; // } // foreach (Game.Character Target in World.H_Chars.Values) // { // if (Game.Character.Name == NewLeader) // Char = Cli.Char; // } // if (Char != null) // { // if (G.Members.ContainsKey(Char.EntityID)) // { // Features.MemberInfo M = NewestCOServer.Features.Guilds.ValidName[Char.EntityID]; // M.Rank = NewestCOServer.Features.GuildRank.GuildLeader; // Char.GuildRank = NewestCOServer.Features.GuildRank.GuildLeader; // GC.MyChar.GuildRank = NewestCOServer.Features.GuildRank.Member; // Game.World.Spawn(Char, false); // Char.MyClient.AddSend(Packets.GuildInfo(Char.MyGuild, Char)); // } // else // { // Text("You don't have a member with that name or the member isn't online!", GC); // Link("I see", 255, GC); // Face(N.Avatar, GC); // End(GC); // return; // } // } // else // { // Text("You don't have a member with that name or the member isn't online!", GC); // Link("I see", 255, GC); // Face(N.Avatar, GC); // End(GC); // return; // } // } // #endregion #region Enemy else if (Control == 9) { if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader) { Text("Please, tell me the guild name.", GC); GC.AddSend(Packets.NPCLink2("Guild Name", 50)); Link("Just passing by", 255, GC); Face(N.Avatar, GC); End(GC); } else { GC.AddSend(Packets.NPCSay("You're not the guild leader... Please leave me!")); } } else if (Control == 50) { string name = ReadString(Data); Guild Enemy = null; #region read guild foreach (Guild G in Game.GameGuilds.Values) { if (G != null) { if (G.ID != GC.Char.Guild.ID) { Enemy = G; } } } #endregion if (Enemy == null) { GC.AddSend(Packets.NPCSay("Hmmm... This guild name is invalid, doesn't exist a guild with that name!")); } else { if (!GC.MyChar.MyGuild.Enemies.ContainsKey(Enemy.GuildID)) GC.MyChar.MyGuild.Enemies.Add(Enemy.GuildID, 0); Database.NewEnemy(GC.MyChar.MyGuild.GuildID, Enemy.GuildID); Game.World.Spawns(GC.MyChar, false); } } else if (Control == 60) { if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader) { Text("Please, tell me the guild name.", GC); GC.AddSend(Packets.NPCLink2("Guild Name", 61)); Link("Just passing by", 255, GC); Face(N.Avatar, GC); End(GC); } else { GC.AddSend(Packets.NPCSay("You're not the guild leader... Please leave me!")); } } else if (Control == 61) { string name = ReadString(Data); Guild Enemy = null; #region read guild foreach (Guild G in Game.GameGuilds.Values) { if (G != null) { if (G.ID != GC.Char.Guild.ID) { Enemy = G; } } } #endregion if (Enemy == null) { GC.AddSend(Packets.NPCSay("Hmmm... This guild name is invalid, doesn't exist a guild with that name!")); } else { if (GC.MyChar.MyGuild.Enemies.ContainsKey(Enemy.GuildID)) { GC.MyChar.MyGuild.Enemies.Remove(Enemy.GuildID); Database.DeleteEnemy(GC.MyChar.MyGuild.GuildID, Enemy.GuildID); } Game.World.Spawns(GC.MyChar, false); } } #endregion #region Ally else if (Control == 12) { if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader) { if (GC.MyChar.MyTeam != null && GC.MyChar.TeamLeader) { foreach (Character C in GC.MyChar.MyTeam.Members) { if (C.EntityID != GC.MyChar.EntityID) { if (Calculate.InBox(GC.MyChar.Loc.X, GC.MyChar.Loc.Y, C.Loc.X, C.Loc.Y, 15)) { if (C.MyGuild != null && C.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader) { Guild my = GC.MyChar.Guild; Guild ally = C.MyGuild; if (!my.Allies.ContainsKey(ally.ID) && !ally.Allies.ContainsKey(my.GuildID)) { try { my.Allies.Add(ally.ID, 0); ally.Allies.Add(my.ID, 0); } catch { } Database.NewAlly(my.ID, ally.ID); Database.NewAlly(ally.ID, my.ID); Actions.Spawns(GC.Char, false); Actions.Spawns(C, false); break; } else { GC.AddSend(Packets.NPCSay("This guild is already your ally!")); } } } } } } else { GC.AddSend(Packets.NPCSay("Make a team first!")); } } else { GC.AddSend(Packets.NPCSay("You're not the guild leader... Please leave me!")); } } else if (Control == 62) { if (GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader) { Text("Please, tell me the guild name.", GC); GC.AddSend(Packets.NPCLink2("Guild Name", 63)); Link("Just passing by", 255, GC); Face(N.Avatar, GC); End(GC); } else { GC.AddSend(Packets.NPCSay("You're not the guild leader... Please leave me!")); } } else if (Control == 63) { string name = ReadString(Data); Guild Ally = null; #region read guild foreach (Guild G in Game.GameGuilds.Values) { if (G != null) { if (G.ID != GC.Char.Guild.ID) { Ally = G; } } } #endregion if (Ally == null) { GC.AddSend(Packets.NPCSay("Hmmm... This guild name is invalid, doesn't exist a guild with that name!")); } else { if (GC.MyChar.MyGuild.Allies.ContainsKey(Ally.GuildID)) { GC.MyChar.MyGuild.Allies.Remove(Ally.GuildID); Database.DeleteAlly(GC.MyChar.MyGuild.GuildID, Ally.GuildID); } Game.World.Spawns(GC.MyChar, false); } } #endregion else if (Control == 13) { Text("I am what my name says. I help create and manage guilds. So what do you want to do?", GC); Link("Ally to a guild", 12, GC); Link("Remove Ally", 62, GC); Link("Enemy to a guild", 9, GC); Link("Remove Enemy", 60, GC); Link("Just passing by", 255, GC); Face(N.Avatar, GC); End(GC); } break; } #endregion