public override bool Cast(LKCamelot.model.Player player) { CheckLevelUp(player); player.AddBuff(this); return(true); }
public static List<LKCamelot.model.Player> LoadPlayers() { lock (readPlayerlock) { List<LKCamelot.model.Player> temp = new List<LKCamelot.model.Player>(); using (StreamReader sr = new StreamReader("worldsavePl.txt")) { while (!sr.EndOfStream) { string[] line = sr.ReadLine().Split(','); var ret = new LKCamelot.model.Player(); ret.Serial = Convert.ToInt32(line[0]); ret.Name = line[1]; ret.Pass = line[2]; ret.m_Class = (LKCamelot.library.Class)Convert.ToInt32(line[3]); ret.Stage = (byte)Convert.ToInt32(line[4]); ret.LightRad = (byte)Convert.ToInt32(line[5]); ret.Transparancy = (byte)Convert.ToInt32(line[6]); ret.m_Map = line[7]; ret.m_Loc = new model.Point2D(Convert.ToInt32(line[8]), Convert.ToInt32(line[9])); ret.Face = (byte)Convert.ToInt32(line[10]); ret.m_Str = (ushort)Convert.ToInt32(line[11]); ret.m_Men = (ushort)Convert.ToInt32(line[12]); ret.m_Dex = (ushort)Convert.ToInt32(line[13]); ret.m_Vit = (ushort)Convert.ToInt32(line[14]); ret.m_Extra = Convert.ToUInt32(line[15]); ret.m_HP = (ushort)Convert.ToInt32(line[16]); ret.m_HPCur = (ushort)Convert.ToInt32(line[17]); ret.m_MP = (ushort)Convert.ToInt32(line[18]); ret.m_MPCur = Convert.ToInt32(line[19]); ret.m_Level = (short)Convert.ToInt32(line[20]); ret.m_XP = Convert.ToInt32(line[21]); ret.m_Gold = Convert.ToUInt64(line[22]); ret.LoadMagic(line[23]); ret.client = null; temp.Add(ret); } } return temp; } }
public static LKCamelot.model.Player LoadPlayer(io.IOClient client, string name) { lock (readPlayerlock) { LKCamelot.model.Player ret = null; using (StreamReader sr = new StreamReader("worldsavePl.txt")) { while (!sr.EndOfStream) { string[] line = sr.ReadLine().Split(','); if (line[1] != name) continue; ret = new LKCamelot.model.Player(client); ret.Serial = Convert.ToInt32(line[0]); ret.Name = line[1]; ret.Pass = line[2]; ret.Class = (LKCamelot.library.Class)Convert.ToInt32(line[3]); ret.Stage = (byte)Convert.ToInt32(line[4]); ret.LightRad = (byte)Convert.ToInt32(line[5]); ret.Transparancy = (byte)Convert.ToInt32(line[6]); ret.Map = line[7]; ret.Loc = new model.Point2D(Convert.ToInt32(line[8]), Convert.ToInt32(line[9])); ret.Face = (byte)Convert.ToInt32(line[10]); ret.apStr = (ushort)Convert.ToInt32(line[11]); ret.apMen = (ushort)Convert.ToInt32(line[12]); ret.apDex = (ushort)Convert.ToInt32(line[13]); ret.apVit = (ushort)Convert.ToInt32(line[14]); ret.m_Extra = (ushort)Convert.ToInt32(line[15]); ret.m_HP = (ushort)Convert.ToInt32(line[16]); ret.m_HPCur = (ushort)Convert.ToInt32(line[17]); ret.m_MP = (ushort)Convert.ToInt32(line[18]); ret.m_MPCur = Convert.ToInt32(line[19]); ret.m_Level = (short)Convert.ToInt32(line[20]); ret.m_XP = Convert.ToInt32(line[21]); ret.m_Gold = Convert.ToUInt64(line[22]); ret.LoadMagic(line[23]); } } return ret; } }
public void LoginMessage(LKCamelot.LoginProto msg) { var accs = LKCamelot.model.PlayerHandler.getSingleton().add.Values; player = accs.Where(xe => xe.Name == msg.LoginP.user).FirstOrDefault(); bool result; if (player.Pass.Length > 10) result = LKCamelot.util.Cryption.CheckHashPass(player.Pass, player.Name, msg.LoginP.shapassword); else result = (player.Pass == msg.LoginP.shapassword); LoginProto logResp = new LoginProto(); logResp.LoginReponseP = new LoginResponse(); if (player != null) { if (player.loggedIn) { logResp.LoginReponseP.loginresp = LoginResponse.LoginStatus.LOGGEDIN; } else if (!result) { logResp.LoginReponseP.loginresp = LoginResponse.LoginStatus.WRONGPASS; } else if (result) { player.loggedIn = true; player.apistate = 1; player.keepalive = Server.tickcount.ElapsedMilliseconds; logResp.LoginReponseP.loginresp = LoginResponse.LoginStatus.SUCCESS; logResp.LoginReponseP.classtype = ((int)player.m_Class).ToString(); } } else { logResp.LoginReponseP.loginresp = LoginResponse.LoginStatus.WRONGPASS; } iweb.Send(CreateBuffer(logResp)); }
public SetMP(LKCamelot.model.Player play) : base(0x11) { m_Stream.Write(Util.checkUShort((uint)play.MPCur)); }
public void GetAuctions(LKCamelot.model.Player play) { var aucs = LKCamelot.model.World.NewAuctions.Values.OrderBy(xe => xe.item.Name).ThenBy(xe => xe.item.Stage).ThenBy(xe => xe.goldprice).ToList(); LoginProto curResp = new LoginProto(); curResp.GetAuctionsResponseP = new GetAuctionsResponse(); var templ = new List <AuctionTraderItem>(); foreach (var item in aucs) { if (item.state == script.item.aucState.sold && item.buyerSerial != play.Serial) { continue; } var tt = new AuctionTraderItem(); var ti = new TraderItem(); ti.Name = item.item.Name; if (item.item.Stage > 0) { ti.Name += "<br>" + item.item.NPrefix() + "(" + item.item.Stage + ")"; } ti.Quantity = item.item.Quantity.ToString(); ti.Serial = ((int)item.item.m_Serial).ToString(); ti.Sprite = item.item.m_ItemID.ToString(); ti.Stage = item.item.Stage.ToString(); tt.Gold = item.goldprice.ToString(); tt.AGold = item.agoldprice.ToString(); tt.flags = item.flags.ToString(); tt.BItem = ti; tt.count = 1; if (item.sellerSerial == play.Serial && item.state == script.item.aucState.forsale) { tt.flags = "3"; } if (item.buyerSerial == play.Serial && item.state == script.item.aucState.sold) { tt.flags = "2"; } templ.Add(tt); } var templ2 = templ.ToList(); AuctionTraderItem lastitem = new AuctionTraderItem(); lastitem.BItem = new TraderItem(); foreach (var temp in templ2) { if (temp.BItem.Name == lastitem.BItem.Name && temp.flags == "1") { templ.Remove(temp); templ[templ.IndexOf(lastitem)].count++; continue; } lastitem = temp; } curResp.GetAuctionsResponseP.auctiontraderItem = templ; iweb.Send(CreateBuffer(curResp)); }