public static List<script.item.AuctionItem> LoadAuctions() { var ret = new List<script.item.AuctionItem>(); using (StreamReader sr = new StreamReader("worldsaveAi.txt")) { while (!sr.EndOfStream) { string[] line = sr.ReadLine().Split(','); script.item.Item temp = null; script.item.AuctionItem temp2 = null; try { temp = (script.item.Item)Activator.CreateInstance(Type.GetType("LKCamelot.script.item." + line[1]), (LKCamelot.model.Serial)Convert.ToInt32(line[0])); } catch { Console.WriteLine(line[1]); continue; } temp.m_ItemID = Convert.ToInt32(line[2]); temp.ParSer = Convert.ToInt32(line[3]); temp.InvSlot = Convert.ToInt32(line[4]); temp.Stage = Convert.ToInt32(line[5]); temp.Quantity = Convert.ToInt32(line[6]); temp2 = new script.item.AuctionItem(temp, Convert.ToUInt64(line[7]), Convert.ToInt32(line[9])); temp2.item = temp; temp2.sellerSerial = Convert.ToInt32(line[10]); temp2.buyerSerial = Convert.ToInt32(line[11]); temp2.state = (script.item.aucState)Convert.ToInt32(line[12]); ret.Add(temp2); } } return ret; }
public void CreateAuction(LKCamelot.LoginProto msg, LKCamelot.model.Player play) { int ser = 0; ulong gold = 0; int agold = 0; try{ ser = Convert.ToInt32(msg.CreateAuctionP.ItemSerial); gold = Convert.ToUInt64(msg.CreateAuctionP.Gold); agold = Convert.ToInt32(msg.CreateAuctionP.AGold); } catch { return; } var item = play.Inventory.Where(xe => xe.m_Serial == ser && (xe.Parent == play || xe.ParSer == play.Serial)).FirstOrDefault(); if (item != null) { LKCamelot.script.item.Item it; var aucit = new script.item.AuctionItem(item, gold, 1, agold); aucit.sellerSerial = play.Serial; aucit.state = script.item.aucState.forsale; LKCamelot.model.World.NewItems.TryRemove(item.m_Serial, out it); LKCamelot.model.World.NewAuctions.TryAdd(item.m_Serial, aucit); } GetItemsMessage(msg, play); GetAuctions(play); }
public static List <script.item.AuctionItem> LoadAuctions() { var ret = new List <script.item.AuctionItem>(); using (StreamReader sr = new StreamReader("worldsaveAi.txt")) { while (!sr.EndOfStream) { string[] line = sr.ReadLine().Split(','); script.item.Item temp = null; script.item.AuctionItem temp2 = null; try { temp = (script.item.Item)Activator.CreateInstance(Type.GetType("LKCamelot.script.item." + line[1]), (LKCamelot.model.Serial)Convert.ToInt32(line[0])); } catch { Console.WriteLine(line[1]); continue; } temp.m_ItemID = Convert.ToInt32(line[2]); temp.ParSer = Convert.ToInt32(line[3]); temp.InvSlot = Convert.ToInt32(line[4]); temp.Stage = Convert.ToInt32(line[5]); temp.Quantity = Convert.ToInt32(line[6]); temp2 = new script.item.AuctionItem(temp, Convert.ToUInt64(line[7]), Convert.ToInt32(line[9])); temp2.item = temp; temp2.sellerSerial = Convert.ToInt32(line[10]); temp2.buyerSerial = Convert.ToInt32(line[11]); temp2.state = (script.item.aucState)Convert.ToInt32(line[12]); ret.Add(temp2); } } return(ret); }
public void CreateAuction(LKCamelot.LoginProto msg, LKCamelot.model.Player play) { int ser = 0; ulong gold = 0; int agold = 0; try{ ser = Convert.ToInt32(msg.CreateAuctionP.ItemSerial); gold = Convert.ToUInt64(msg.CreateAuctionP.Gold); agold = Convert.ToInt32(msg.CreateAuctionP.AGold); } catch{return;} var item = play.Inventory.Where(xe => xe.m_Serial == ser && (xe.Parent == play || xe.ParSer == play.Serial)).FirstOrDefault(); if (item != null) { LKCamelot.script.item.Item it; var aucit = new script.item.AuctionItem(item, gold, 1, agold); aucit.sellerSerial = play.Serial; aucit.state = script.item.aucState.forsale; LKCamelot.model.World.NewItems.TryRemove(item.m_Serial, out it); LKCamelot.model.World.NewAuctions.TryAdd(item.m_Serial, aucit); } GetItemsMessage(msg, play); GetAuctions(play); }