public void DrawWadrobeStaff(Wardrobe s) { List <List <IWear> > ls = new List <List <IWear> >(); if (s.Things != null) { ls = s.Things.Cast <IWear>().ToList().GroupBy(x => new { x.Name, x.id, x.Price, x.Durability }).OrderBy(o => o.Key.Name).Select(obj => obj.ToList()).ToList();//.GroupBy(n => n.); } String html = @" <table width='100%' cellpadding='2' cellspacing='2'> <tr> <th>Надето на мне</th> <th>" + s.Name + @"</th> </tr> <tr> <td width='50%' valign='top' style='padding-right: 2px'> "; html += "<div style='width:310px; height:551px'><img src='/Resources/Siluet.png' style='position:absolute'>"; String Hat = ""; if (GetPlayer().Hat != null) { String ev = RegisterEvent(() => { data.Undress(data.player.Hat, s); }); Hat = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().Hat.Image + "' title='" + GetPlayer().Hat.Name + "'></a>"; } String TopDress = ""; if (GetPlayer().TopDress != null) { String ev = RegisterEvent(() => { data.Undress(data.player.TopDress, s); }); TopDress = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().TopDress.Image + "' title='" + GetPlayer().TopDress.Name + "'></a>"; } String BottomDress = ""; if (GetPlayer().BottomDress != null) { String ev = RegisterEvent(() => { data.Undress(data.player.BottomDress, s); }); BottomDress = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().BottomDress.Image + "' title='" + GetPlayer().BottomDress.Name + "'></a>"; } String Shoes = ""; if (GetPlayer().Shoes != null) { String ev = RegisterEvent(() => { data.Undress(data.player.Shoes, s); }); Shoes = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().Shoes.Image + "' title='" + GetPlayer().Shoes.Name + "'></a>"; } String Stockings = ""; if (GetPlayer().Stockings != null) { String ev = RegisterEvent(() => { data.Undress(data.player.Stockings, s); }); Stockings = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().Stockings.Image + "' title='" + GetPlayer().Stockings.Name + "'></a>"; } String Coat = ""; if (GetPlayer().Coat != null) { String ev = RegisterEvent(() => { data.Undress(data.player.Coat, s); }); Coat = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().Coat.Image + "' title='" + GetPlayer().Coat.Name + "'></a>"; } String Bra = ""; if (GetPlayer().Bra != null) { String ev = RegisterEvent(() => { data.Undress(data.player.Bra, s); }); Bra = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().Bra.Image + "' title='" + GetPlayer().Bra.Name + "'></a>"; } String Panties = ""; if (GetPlayer().Panties != null) { String ev = RegisterEvent(() => { data.Undress(data.player.Panties, s); }); Panties = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().Panties.Image + "' title='" + GetPlayer().Panties.Name + "'></a>"; } String SmallBaga = ""; if (GetPlayer().SmallBag != null) { String ev = RegisterEvent(() => { if (!data.Undress(data.player.SmallBag, s)) { sc.Message = "Выложите все из маленькой сумочки"; } }); SmallBaga = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().SmallBag.Image + "' title='" + GetPlayer().SmallBag.Name + "'></a>"; } String Baga = ""; if (GetPlayer().Bag != null) { String ev = RegisterEvent(() => { if (!data.Undress(data.player.Bag, s)) { sc.Message = "Выложите все из дополнительной сумки"; } }); Baga = @"<a href='callback:" + ev + @"'><img src='" + GetPlayer().Bag.Image + "' title='" + GetPlayer().Bag.Name + "'></a>"; } html += @" <div class=""position Hat"">" + Hat + @"</div> <div class=""position TopDress"">" + TopDress + @"</div> <div class=""position BottomDress"">" + BottomDress + @"</div> <div class=""position Shoes"">" + Shoes + @"</div> <div class=""position Stockings"">" + Stockings + @"</div> <div class=""position Coat"">" + Coat + @"</div> <div class=""position Bra"">" + Bra + @"</div> <div class=""position Panties"">" + Panties + @"</div> <div class=""position SmallBag"">" + SmallBaga + @"</div> <div class=""position Bag"">" + Baga + @"</div> "; html += "</div>"; html += "<br/><b>У меня с собой</b>:<br /><table class=\"tableview\" cellpadding='2' cellspacing='2'>"; if (data.player.SmallBag != null) { var SmallBag = data.player.SmallBag.Things.Where(z => z.classtype == "IWear").GroupBy(x => new { x.Name, x.id }).OrderBy(o => o.Key.Name).Select(obj => obj.ToList()).ToList(); html += "<tr><td colspan='3'>" + data.player.SmallBag.Name + "</td></tr>"; foreach (var stfobj in SmallBag) { var stf = stfobj.FirstOrDefault(); String ev = RegisterEvent(() => { data.DropThning(stf, s, 1, data.player.SmallBag); }); html += @"<tr> <td>" + ((String.IsNullOrEmpty(stf.Image)) ? stf.Name : "<img title='" + stf.Name + "' src='" + stf.Image + "' width='70'>") + @"</td> <td>" + stfobj.Count + @"</td> <td><a href='callback:" + ev + @"'><img src='/Resources/ToBox.png' width='24'></a></td> </tr>"; } } if (data.player.Bag != null) { var Bag = data.player.Bag.Things.GroupBy(x => new { x.Name, x.id }).OrderBy(o => o.Key.Name).Select(obj => obj.ToList()).ToList(); html += "<tr><td colspan='3'>" + data.player.Bag.Name + "</td></tr>"; foreach (var stfobj in Bag) { var stf = stfobj.FirstOrDefault(); String ev = RegisterEvent(() => { data.DropThning(stf, s, 1, data.player.Bag); }); html += @"<tr> <td>" + ((String.IsNullOrEmpty(stf.Image)) ? stf.Name : "<img title='" + stf.Name + "' src='" + stf.Image + "' width='70'>") + @"</td> <td>" + stfobj.Count + @"</td> <td><a href='callback:" + ev + @"'><img src='/Resources/ToBox.png' width='24'></a></td> </tr>"; } } html += "</table>"; html += @"</td> <td width='50%' valign='top' style='padding-left: 1px'> <table class=""tableview"" border='1' cellpadding='2' cellspacing='2'> <tr> <th>Название</th> <th><span title='Прочность'>Пр</span></th> <th><span title='Количество'>Кл</span></th> <th></th> </tr>"; foreach (var staff in ls) { var stf = (IWear)staff.FirstOrDefault(); String tobag = ""; if (data.player.Bag != null) { tobag = "<a href='callback:" + RegisterEvent(() => { if (!data.GetThningToBag(stf, s, 1, data.player.Bag)) { sc.Message = "Недостаточно места в сумке"; } }) + "'><img width='24' title='В сумку' src='/Resources/Bag.png'></a>"; } String tosmallbag = ""; if (data.player.SmallBag != null) { tosmallbag = "<a href='callback:" + RegisterEvent(() => { if (!data.GetThningToBag(stf, s, 1, data.player.SmallBag)) { sc.Message = "Недостаточно места в сумке"; } }) + "'><img width='24' title='В маленькую сумку' src='/Resources/SmallBag.jpg'></a>"; } String DressCB = RegisterEvent(() => { if (!data.WearToMe(stf, s)) { sc.Message = "Нельзя надеть одежду. Сначала снимите другую одежду"; } }); String outof = RegisterEvent(() => { s.RemoveStaff(stf, 1); }); html += @"<tr> <td><a href='callback:" + DressCB + "'>" + ((String.IsNullOrEmpty(stf.Image)) ? stf.Name : "<img title='" + stf.Name + "' src='" + stf.Image + "' width='70'>") + @"</a></td> <td>" + stf.Durability + @"</td> <td>" + staff.Count + @"</td> <td>" + tobag + @"" + tosmallbag + @"<a href='callback:" + outof + @"' class="""" onclick=""ConfirmDelete(this)""><img width='24' title='Выкинуть' src='/Resources/DeleteRed.png'></a></td> </tr>"; } html += "</table></td></tr></table>"; sc.Description += html + "<br/>"; }
public bool WearToMe(IWear stuff, Wardrobe location) { IStuff st = location.GetStaff(stuff); switch (stuff.WearSlot) { case 1: if (player.Hat != null) { location.MoveStuff(player.Hat, 1); player.Hat = null; } break; case 2: if (stuff.ConflictSlot == 3 && player.BottomDress != null) { return(false); } if (player.TopDress != null) { location.MoveStuff(player.TopDress, 1); player.TopDress = null; } break; case 3: if (stuff.ConflictSlot == 2 && player.TopDress != null && player.TopDress.ConflictSlot == 3) { return(false); } if (player.BottomDress != null) { location.MoveStuff(player.BottomDress, 1); player.BottomDress = null; } break; case 4: if (player.Shoes != null) { location.MoveStuff(player.Shoes, 1); player.Shoes = null; } break; case 5: if (player.Stockings != null) { location.MoveStuff(player.Stockings, 1); player.Stockings = null; } break; case 6: if (player.Coat != null) { location.MoveStuff(player.Coat, 1); player.Coat = null; } break; case 7: if (player.Bra != null) { location.MoveStuff(player.Bra, 1); player.Bra = null; } break; case 8: if (player.Panties != null) { location.MoveStuff(player.Panties, 1); player.Panties = null; } break; case 9: if (player.SmallBag != null) { location.MoveStuff(player.SmallBag, 1); player.SmallBag = null; } break; case 10: if (player.Bag != null) { location.MoveStuff(player.Bag, 1); player.Bag = null; } break; } if (player.WearStuff(stuff)) { location.RemoveStaff(stuff, 1); return(true); } return(false); }