public DamageCircle(Hero heroOwner, Mob mobOwner, bool destroyOnHit, int id, MapRoom room) { Id = id; HeroOwner = heroOwner; MobOwner = mobOwner; DestroyOnHit = destroyOnHit; Room = room; ShapeManager.AddCircle(this); }
public DamageCircle AddCircle(Hero heroOwner, Mob mobOwner, TimeSpan lifeSpan, bool destroyOnHit, MapRoom room) { DamageCircle c = new DamageCircle(heroOwner, mobOwner, destroyOnHit, NextId++, room); Circles.Add(c); //remove event Globals.EventManager.AddEvent(delegate () { c.Destroy(); return 0; }, $"removecircle{NextId - 1}", false, lifeSpan, TimeSpan.Zero, TimeSpan.Zero); return c; }
private void AddPlayer(byte[] rawdata) { var data = Functions.GetData(rawdata); Hero h = new Hero((string)data[0], (HeroClass)Convert.ToChar(data[2])); h.Netid = (int)data[1]; h.Position = new Vector3((float)data[3], (float)data[4], ZLayer.Npc); h.Target = h.Position; Globals.Players.Add(h); }
public Hero ToHero() { Hero hero = new Hero(Name, Class); hero.Gold = Gold; hero.Vit = Vit; hero.Str = Str; hero.Agi = Agi; hero.Ene = Ene; hero.Level = Level; hero.Exp = Exp; hero.ExpNext = ExpNext; hero.ExpPrevious = ExpPrevious; hero.StatPoints = StatPoints; hero.Map = Map; hero.Online = Online; hero.ExperienceBoost = ExperienceBoost; hero.ExperienceBoost = hero.ExperienceBoost.Clamp(1, 2); return hero; }
private void CreateNewCharacter() { if (!IsNameValid()) { string msg = "Invalid name\n*letter, number and spaces only\n*cannot begin or end with space\n*no 2 spaces in a row\n*min 3 characters"; new MessageBox(msg); return; } if (zHeroClass == HeroClass.Invalid) { new MessageBox("Select class"); return; } string fileName = Path.Make(Path.Save, zNametextbox.Text); fileName = fileName.Replace(" ", "_"); fileName += ".hero"; if (System.IO.File.Exists(Path.Make(Path.Save, fileName))) { new MessageBox("This name is taken"); return; } Hero hero = new Hero(zNametextbox.Text, zHeroClass); SaveHero shero = hero.ToSavehero(); Functions.Serialize(fileName, shero); hero.Destroy(); MainMenu m = (MainMenu)ScreenManager.CurrentScreen; m.ReloadCharacterList(); Destroy(); }