//Set's the card's index to idx. Enforces a TableOnly rule, since the index's on other piles/groups are inverted.
//ralig98
public void CardSetIndex(int CardId, int idx, bool TableOnly = false)
{
if (idx < 0)
{
Program.GameMess.Warning("Cannot setIndex({0}), number is less than 0", idx);
return;
}
Card card = Card.Find(CardId);
if (card.Controller != Player.LocalPlayer)
{
Program.GameMess.Warning(String.Format("{0} Can't set index of {1} to Table because they don't control {1}.", Player.LocalPlayer.Name, card.Name));
}
if (card.Group != Program.GameEngine.Table && card.Group.Controller != Player.LocalPlayer)
{
Program.GameMess.Warning(String.Format("{0} Can't set index of {1} in {2} because they don't control it.", Player.LocalPlayer.Name, card, card.Group));
}
if (!TableOnly || (TableOnly && card.Group is Table))
{
QueueAction(
() =>
{
//Program.GameEngine.EventProxy.MuteEvents = true;
card.MoveToTable((int)card.X, (int)card.Y, card.FaceUp, idx, true);
//Program.GameEngine.EventProxy.MuteEvents = false;
});
}
}