here is my issue , O.o
[Only registered and activated users can see links. Click Here To Register...]
any help ?
[Only registered and activated users can see links. Click Here To Register...]
any help ?
#region KnownPersons
static void RemoveFriend(KnownPersons knownperson, Client.GameState client)
{
if (client.Friends.ContainsKey(knownperson.UID))
{
Game.ConquerStructures.Society.Friend friend = client.Friends[knownperson.UID];
if (friend.IsOnline)
{
friend.Client.Friends.Remove(client.Entity.UID);
friend.Client.Send(new KnownPersons(true)
{
UID = client.Entity.UID,
Type = KnownPersons.RemovePerson,
Name = "",
Online = false
});
}
client.Friends.Remove(friend.ID);
client.Send(new KnownPersons(true)
{
UID = friend.ID,
Type = KnownPersons.RemovePerson,
Name = "",
Online = false
});
Database.KnownPersons.RemoveFriend(client, friend.ID);
}
}
static void RemoveEnemy(KnownPersons knownperson, Client.GameState client)
{
if (client.Enemy.ContainsKey(knownperson.UID))
{
Game.ConquerStructures.Society.Enemy enemy = client.Enemy[knownperson.UID];
client.Enemy.Remove(enemy.ID);
client.Send(new KnownPersons(true)
{
UID = enemy.ID,
Type = KnownPersons.RemovePerson,
Name = "",
Online = false
});
Database.KnownPersons.RemoveEnemy(client, enemy.ID);
}
}
static void AddFriend(KnownPersons knownperson, Client.GameState client)
{
if (!client.Friends.ContainsKey(knownperson.UID))
{
Client.GameState Client = ServerBase.Kernel.GamePool[knownperson.UID];
if (Client != null)
{
Client.OnMessageBoxOK = delegate
{
if (client != null)
{
if (client.Socket.Connected)
{
if (!Client.Friends.ContainsKey(client.Entity.UID))
{
client.Friends.Add(Client.Entity.UID, new Conquer_Online_Server.Game.ConquerStructures.Society.Friend()
{
ID = Client.Entity.UID,
Name = Client.Entity.Name
});
Client.Friends.Add(client.Entity.UID, new Conquer_Online_Server.Game.ConquerStructures.Society.Friend()
{
ID = client.Entity.UID,
Name = client.Entity.Name
});
client.Send(new KnownPersons(true)
{
UID = Client.Entity.UID,
Type = KnownPersons.AddFriend,
Name = Client.Entity.Name,
Online = true
});
Client.Send(new KnownPersons(true)
{
UID = client.Entity.UID,
Type = KnownPersons.AddFriend,
Name = client.Entity.Name,
Online = true
});
Database.KnownPersons.AddFriend(client, client.Friends[Client.Entity.UID]);
client.Screen.SendScreen(new Message(Client.Entity.Name + " has accepted " + client.Entity.Name + "'s friendship request.", System.Drawing.Color.Blue, Message.TopLeft), true);
}
}
}
};
Client.OnMessageBoxCANCEL = delegate
{
if (client != null)
{
if (client.Socket.Connected)
{
if (Client != null)
{
if (Client.Socket.Connected)
{
client.Send(new Message(Client.Entity.Name + " has rejected your friendship request.", System.Drawing.Color.Blue, Message.TopLeft));
}
}
}
}
};
Client.Send(new NpcReply(NpcReply.MessageBox, client.Entity.Name + " wants to be your friend."));
}
}
}
public static void AddEnemy(Client.GameState client, Client.GameState enemy)
{
if (!client.Enemy.ContainsKey(enemy.Entity.UID))
{
client.Enemy.Add(enemy.Entity.UID, new Conquer_Online_Server.Game.ConquerStructures.Society.Enemy()
{
ID = enemy.Entity.UID,
Name = enemy.Entity.Name
});
client.Send(new KnownPersons(true)
{
UID = enemy.Entity.UID,
Type = KnownPersons.AddEnemy,
Name = enemy.Entity.Name,
Online = true
});
Database.KnownPersons.AddEnemy(client, client.Enemy[enemy.Entity.UID]);
}
}
#endregion
public void SendScreen(Interfaces.IPacket buffer, bool self)
{
for (int c = 0; c < Objects.Count(); c++)
{
//For a multi threaded application, while we go through the collection
//the collection might change. We will make sure that we wont go off
//the limits with a check.
if (c >= Objects.Count())
break;
Interfaces.IMapObject _obj = Objects[c];
if (_obj == null)
continue;
if (_obj.UID != Owner.Entity.UID)
{
if (_obj.MapObjType == Game.MapObjectType.Player)
{
GameState client = _obj.Owner as GameState;
if (Owner.WatchingGroup != null && client.WatchingGroup == null)
continue;
client.Send(buffer);
}
}
}
if (self)
Owner.Send(buffer);
}
you see this error ?Quote:
change this (int c = 0; c < Objects.Count(); c++)
for (int c = 0; c < Objects.Length(); c++)
and if (c >= Objects.Count())
for if (c >= Objects.Length())