Only compatible for stream public/common sources
This command usage: removeitemandcompensate itemid playerCompensationCPs
Example: @removeitemandcompensate 191305 500
// Remove the item 191305 from inventory of online players in the moment and compensate with 500CPs
case "removeitemandcompensate":
{
client.SendSysMesage("[Info] This command remove all item specificated from online players inventory.");
client.SendSysMesage("[Usage: removeitemandcompensate itemid playerCompensationCPs player(optional)]");
uint itemID = uint.Parse(data[1]);
uint playerCompensationCPs = uint.Parse(data[2]);
string playerName = null;
if (data.Length > 3)
{
playerName = data[3];
}
List<Client.GameClient> fromClients = Pool.GamePoll.Values.ToList();
if (playerName != null && playerName.Length > 0)
{
fromClients = Pool.GamePoll.Values.Where(x => x.Player.Name == playerName).ToList();
}
foreach (var user in fromClients)
{
while (user.Inventory.Contain(itemID, 1) || user.Inventory.Contain(itemID, 1, 1))
{
Database.ItemType.DBItem item;
Pool.ItemsBase.TryGetValue(itemID, out item);
using (var rec = new RecycledPacket())
{
var stream = rec.GetStream();
user.Inventory.Remove(itemID, 1, stream);
user.Player.ConquerPoints += playerCompensationCPs;
}
user.SendSysMesage($"The PM has removed the item {item.Name} from your inventory and compensate you with {playerCompensationCPs}CPs", ChatMode.System, MsgColor.white);
}
}
break;
}