public PlayerObject(CharacterInfo TempData, MirConnection Con) { TempData.Lock = true; this.Con = Con; this.Data = TempData; LoadData(); if (Level == 0) { NewCharacter(); } else { RefreshAll(); if (HP <= 0) { HP = 10 + (int)(MaxHP * 0.1F); MP = 10 + (int)(MaxMP * 0.1F); Location = HomeLocation; MapIndex = HomeMapIndex; } } }
protected override void Load(CharacterInfo info, MirConnection connection) { info.Mount = new MountInfo(this); Info = info; HInfo = (HeroInfo)info; Stats = new Stats(); if (Level == 0) { NewCharacter(); } RefreshStats(); SendInfo(); switch (HP) { case 0: Dead = true; break; case -1: SetHP(Stats[Stat.HP]); SetMP(Stats[Stat.MP]); break; } }
public static CharacterInfo NewCharacter(C.NewCharacter P, MirConnection Con) { DateTime CreationDate = Main.Now; DBCommand.Parameters.Clear(); DBCommand.CommandText = "INSERT INTO [Character Info] ([Account Index], [Character Name], [Class], [Gender], [Creator IP], [Creation Date], [Last Access]) " + "OUTPUT INSERTED.[Character Index] " + "VALUES (@AccountIndex, @CharacterName, @Class, @Gender, @CreatorIP, @CreationDate, @LastAccess)"; DBCommand.Parameters.AddWithValue("@AccountIndex", Con.Account.AccountIndex); DBCommand.Parameters.AddWithValue("@CharacterName", P.CharacterName); DBCommand.Parameters.AddWithValue("@Class", (byte)P.Class); DBCommand.Parameters.AddWithValue("@Gender", (byte)P.Gender); DBCommand.Parameters.AddWithValue("@CreatorIP", Con.IPAddress); DBCommand.Parameters.AddWithValue("@CreationDate", CreationDate.Ticks); DBCommand.Parameters.AddWithValue("@LastAccess", 0); int Index = (int)DBCommand.ExecuteScalar(); return(new CharacterInfo(P) { CharacterIndex = Index, CreationDate = CreationDate, LastAccess = DateTime.MinValue }); }
public CharacterInfo(ClientPackets.NewCharacter p, MirConnection c) { Name = p.Name; Class = p.Class; Gender = p.Gender; CreationIP = c.IPAddress; CreationDate = SMain.Envir.Now; }
protected override void Load(CharacterInfo info, MirConnection connection) { base.Load(info, connection); if (HasMagic(Spell.DoubleSlash)) { Info.DoubleSlash = true; } }
public static void CreateCharacter(C.NewCharacter P, MirConnection Con) { if (!Settings.AllowNewCharacter) { Con.QueuePacket(new S.NewCharacter { Result = 1 }); return; } if (!AccountIDReg.IsMatch(P.CharacterName)) { Con.QueuePacket(new S.NewCharacter { Result = 2 }); return; } if (P.Gender != MirGender.Male && P.Gender != MirGender.Female) { Con.QueuePacket(new S.NewCharacter { Result = 3 }); return; } if (P.Class != MirClass.Warrior && P.Class != MirClass.Wizard && P.Class != MirClass.Taoist && P.Class != MirClass.Assassin) { Con.QueuePacket(new S.NewCharacter { Result = 4 }); return; } int CharCount = Con.Account.Characters.Count(C => !C.Deleted); if (CharCount >= Globals.MaxCharacterCount) { Con.QueuePacket(new S.NewCharacter { Result = 5 }); return; } if (CharacterExists(P.CharacterName)) { Con.QueuePacket(new S.NewCharacter { Result = 6 }); return; } CharacterInfo CI = NewCharacter(P, Con); Con.Account.Characters.Add(CI); Con.QueuePacket(new S.NewCharacterSuccess { CharInfo = CI.ToSelectInfo() }); }
public static void Login(C.Login P, MirConnection Con) { if (!Settings.AllowLogin) { Con.QueuePacket(new S.Login { Result = 1 }); return; } if (!AccountIDReg.IsMatch(P.AccountID)) { Con.QueuePacket(new S.Login { Result = 2 }); return; } if (!PasswordReg.IsMatch(P.Password)) { Con.QueuePacket(new S.Login { Result = 3 }); return; } AccountInfo TempAccount = GetAccount(P.AccountID); if (TempAccount == null) { Con.QueuePacket(new S.Login { Result = 4 }); return; } if (TempAccount.Banned) { if (TempAccount.ExpiryDate > DateTime.Now) { Con.QueuePacket(new S.LoginBanned { Reason = TempAccount.BanReason, ExpiryDate = TempAccount.ExpiryDate }); return; } else { TempAccount.Banned = false; TempAccount.BanReason = string.Empty; TempAccount.ExpiryDate = DateTime.MinValue; } } if (string.Compare(TempAccount.Password, P.Password, false) != 0) { Con.QueuePacket(new S.Login { Result = 5 }); return; } Network.Disconnect(TempAccount, 1); Con.QueuePacket(new S.LoginSuccess { CharacterList = TempAccount.GetSelectInfo() }); Con.Account = TempAccount; Con.Stage = GameStage.Select; }
public static void ChangePassword(C.ChangePassword P, MirConnection Con) { if (!Settings.AllowChangePassword) { Con.QueuePacket(new S.ChangePassword { Result = 1 }); return; } if (!AccountIDReg.IsMatch(P.AccountID)) { Con.QueuePacket(new S.ChangePassword { Result = 2 }); return; } if (!PasswordReg.IsMatch(P.CurrentPassword)) { Con.QueuePacket(new S.ChangePassword { Result = 3 }); return; } if (!PasswordReg.IsMatch(P.NewPassword)) { Con.QueuePacket(new S.ChangePassword { Result = 4 }); return; } AccountInfo TempAccount = GetAccount(P.AccountID); if (TempAccount == null) { Con.QueuePacket(new S.ChangePassword { Result = 5 }); return; } if (TempAccount.Banned) { if (TempAccount.ExpiryDate > Main.Now) { Con.QueuePacket(new S.ChangePasswordBanned { Reason = TempAccount.BanReason, ExpiryDate = TempAccount.ExpiryDate }); return; } else { TempAccount.Banned = false; TempAccount.BanReason = string.Empty; TempAccount.ExpiryDate = DateTime.MinValue; } } if (string.Compare(TempAccount.Password, P.CurrentPassword, false) != 0) { Con.QueuePacket(new S.ChangePassword { Result = 6 }); return; } TempAccount.Password = P.NewPassword; Con.QueuePacket(new S.ChangePassword { Result = 7 }); }
public static void CreateAccount(C.NewAccount P, MirConnection Con) { if (!Settings.AllowNewAccount) { Con.QueuePacket(new S.NewAccount { Result = 1 }); return; } if (!AccountIDReg.IsMatch(P.AccountID)) { Con.QueuePacket(new S.NewAccount { Result = 2 }); return; } if (!PasswordReg.IsMatch(P.Password)) { Con.QueuePacket(new S.NewAccount { Result = 3 }); return; } if (!string.IsNullOrWhiteSpace(P.EMailAddress) && !EMailReg.IsMatch(P.EMailAddress)) { Con.QueuePacket(new S.NewAccount { Result = 4 }); return; } if (!string.IsNullOrWhiteSpace(P.UserName) && P.UserName.Length > 30) { Con.QueuePacket(new S.NewAccount { Result = 5 }); return; } if (!string.IsNullOrWhiteSpace(P.SecretQuestion) && P.SecretQuestion.Length > 20) { Con.QueuePacket(new S.NewAccount { Result = 6 }); return; } if (!string.IsNullOrWhiteSpace(P.SecretAnswer) && P.SecretAnswer.Length > 20) { Con.QueuePacket(new S.NewAccount { Result = 7 }); return; } if (AccountExists(P.AccountID)) { Con.QueuePacket(new S.NewAccount { Result = 8 }); return; } NewAccount(P, Con.IPAddress); Con.QueuePacket(new S.NewAccount { Result = 9 }); }
public static Bool32 GetMirPresentationSupportKHR(this PhysicalDevice physicalDevice, UInt32 queueFamilyIndex, out MirConnection connection) { unsafe { fixed(MirConnection *ptrconnection = &connection) { return(Linux.Interop.NativeMethods.vkGetPhysicalDeviceMirPresentationSupportKHR(physicalDevice.m, queueFamilyIndex, ptrconnection)); } } }