public Player() { shape = new GlobalShape(); shape.name = "Karl"; shape.speed = 1.0f; shape.isActive = true; uniqueName = shape.name; inventory.isInParty = true; inventory.globalOwner = this; LocalObject c1 = new LocalObject(shape.name, Race.Get("Human"), CharacterClass.Get("Fighter"), Background.Get("Engineer"), Origin.Get("The Withered West"), 0); c1.inventory.Add("Staff"); party.Add(c1); //LocalObject c2 = new LocalObject("Nicolas", Race.Get("Floran"), CharacterClass.Get("Seer"), Background.Get("Hunter"), Origin.Get("Eden"), 140); //party.Add(c2); party.Add(new LocalObject(LocalShape.Get("Krokar"), "Boo-Boo")); inventory.Add("Inperium Coins", 4); inventory.Add("Alliance Coins", 10); inventory.Add("Bottle of Water", 2); inventory.Add("King Bolete", 3); inventory.Add("Potato", 5); }
public ScalingAnimation(LocalObject targeti, float finalScaling, float gameTime) { target = targeti; maxFrameTime = 2 * (int)(6.0f / gameTime); delta = (finalScaling - target.drawing.scaling) / maxFrameTime; frameTime = 0; }
public object Execute(IObject context, IObject receiver, IList <object> arguments) { Message index = (Message)arguments[0]; Message variable = (Message)arguments[1]; IMessage body = (IMessage)arguments[2]; if (index.Arguments != null) { throw new InvalidOperationException("Invalid first argument in foreach"); } if (variable.Arguments != null) { throw new InvalidOperationException("Invalid second argument in foreach"); } IEnumerable list = (IEnumerable)receiver; int n = 0; foreach (object obj in list) { LocalObject local = new LocalObject(context); local.SetLocalSlot(index.Symbol, n); local.SetLocalSlot(variable.Symbol, obj); body.Send(local, local); n++; } return(receiver); }
public List<ZPoint.Direction> Path(ZPoint start, ZPoint finish, LocalObject t = null) { List<FramedZPoint> visited = new List<FramedZPoint>(); visited.Add(new FramedZPoint(finish, true)); while (!start.IsIn(visited)) { List<FramedZPoint> frontier = (from p in visited where p.onFrontier orderby MyMath.ManhattanDistance(p.data, start) select p) .Cast<FramedZPoint>().ToList(); if (frontier.Count() == 0) return null; foreach (FramedZPoint p in frontier) { p.onFrontier = false; foreach (ZPoint.Direction d in ZPoint.Directions) AddToFrontier(visited, p.data.Shift(d), ZPoint.Opposite(d), start, t); } } List<ZPoint.Direction> result = new List<ZPoint.Direction>(); ZPoint position = start; while (!position.TheSameAs(finish)) { ZPoint.Direction d = position.GetDirection(visited); result.Add(d); position = position.Shift(d); } return result; }
public GameObject onDataInit(string pid, string oid, FireNode fn, RemoteData v) { string mePid = PidGeter.getPid(); if (string.IsNullOrEmpty(mePid)) { throw new NullReferenceException("me Pid is null"); } if (string.Equals(pid, mePid)) { LocalPrefabBundle lob = prefabs.Find(p => { return(string.Equals(p.tag, v.tag)); }); LocalObject lo = lob.prefab.gameObject.scene == null?Instantiate(lob.prefab) : lob.prefab; return(center.localRepo.create(lo).gameObject); } else { RemotePlayerRepo rpr; if (CommRemoteRepo.COMM_PID.Equals(pid)) { rpr = center.getCommRemoteRepo(); } else if (center.remoteRepos.ContainsKey(pid)) { rpr = center.remoteRepos[pid]; } else { rpr = center.addRemoteRepo(pid); } rpr.createNewObject(v); return(rpr.get(oid).gameObject); } }
public void Setup() { this.obj = new TopObject(); this.obj.SetSlot("Foo", "Bar"); this.local = new LocalObject(obj); this.local.SetLocalSlot("a", "localvalue"); }
public HPComponent(LocalObject o) : base(o) { damageDealt = new Dictionary<LocalObject, int>(); value = Max; stamina = Max; }
public Initiative(bool isAIControlledi, LocalObject o) : base(o) { value = 0; r = new RPoint(); animations = new AnimationQueue(); isAIControlled = isAIControlledi; movementCounter = 3; }
public Inventory(int _width, int _height, string _name, bool _isInParty, GlobalObject _globalOwner = null, LocalObject _localOwner = null) { width = _width; height = _height; Log.Assert(Size > 0 && Size <= 100, "wrong inventory size"); for (int i = 0; i < Size; i++) data.Add(i, null); globalOwner = _globalOwner; localOwner = _localOwner; name = _name; isInParty = _isInParty; }
public bool IsEnemyTo(LocalObject u) { LocalObject reference = t; if (t.effects != null) { if (t.effects.Has("Mind Controlled")) reference = t.effects.Get("Mind Controlled").parameter as LocalObject; else if (t.effects.Has("Mind Tricked")) reference = t.effects.Get("Mind Tricked").parameter as LocalObject; } if (u == t || u.initiative == null) return false; else return reference.team.isInParty != u.team.isInParty; }
public override object Apply(IObject context, IObject receiver, IList <object> arguments) { LocalObject local = new LocalObject(receiver); for (int k = 0; this.argumentNames != null && k < this.argumentNames.Count; k++) { local.SetLocalSlot(this.argumentNames[k], arguments[k]); } local.SetLocalSlot("self", receiver); return(this.body.Send(local, local)); }
public static void Main() { ChannelServices.RegisterChannel(new HttpChannel(8090)); RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteObject), "RemoteObject", WellKnownObjectMode.Singleton); RemoteObject RObj = (RemoteObject)Activator.GetObject(typeof(RemoteObject), "http://localhost:8090/RemoteObject"); LocalObject LObj = new LocalObject(); RObj.Method1(LObj); Console.WriteLine("Press Return to exit..."); Console.ReadLine(); }
public object Execute(IObject context, IObject receiver, IList <object> arguments) { Message variable = (Message)arguments[0]; IMessage body = (IMessage)arguments[1]; if (variable.Arguments != null) { throw new InvalidOperationException("Invalid first argument in foreach"); } IEnumerable list = (IEnumerable)receiver; List <object> selected = new List <object>(); foreach (object obj in list) { LocalObject local = new LocalObject(context); local.SetLocalSlot(variable.Symbol, obj); object result = body.Send(local, local); // TODO IsFalse predicate to unify this code if (result == null || (result is bool && !((bool)result))) { continue; } selected.Add(obj); } // TODO ListObject.Create(context,element)to unify this code IObject top = context; while (top.Parent != null) { top = top.Parent; } return(new ListObject(top, selected)); }
public void Use(Ability ability, LocalObject target) { if (ability is ClassAbility) { ClassAbility ca = ability as ClassAbility; Action<string> log = s => B.log.Add(" " + s, ca.color); Action<LocalObject, string> logn = (lc, s) => { B.log.AddLine(lc.CommonName, lc.LogColor); log(s); }; if (ca.NameIs("Leadership")) { if (target.GetCreatureType.name == "Sentient") { target.team.isInParty = true; target.initiative.isAIControlled = false; log("persuades " + target.CommonName + " to join the party!"); } else log("tries to persuade " + target.CommonName + "to join the party, but " + target.CommonName + " being " + target.GetCreatureType.name + " is deaf to the arguments."); AnimateByDefault(ability.castTime); } else if (ca.NameIs("Animal Friend")) { if (target.GetCreatureType.name == "Animal") { target.team.isInParty = true; target.initiative.isAIControlled = false; log("pets " + target.CommonName + "."); } else log("tries to pet " + target.CommonName + ", but " + target.CommonName + " being " + target.GetCreatureType.name + " is unresponsive and looks skeptical"); AnimateByDefault(ability.castTime); } else if (ca.NameIs("Pommel Strike")) { t.p.DoDamage(target, 1, false); target.initiative.Add(-6, ability.castTime, false, true); AnimateByDefault(ability.castTime); log("strikes " + target.CommonName + " unexpectedly."); } else if (ca.NameIs("Decapitate")) { t.attack.Animate(target.p.value, ability.castTime); if (target.hp.stamina <= 5) { t.p.DoDamage(target, 5, false); log("decapitates " + target.CommonName + "!"); } else { t.p.DoDamage(target, 1, false); log("tries to decapitate " + target.CommonName + ", but " + target.CommonName + " still has enough stamina to dodge that."); } } else if (ca.NameIs("Psionic Blast")) { t.p.DoDamage(target, 4, true); AnimateByDefault(ability.castTime); log("makes " + target.CommonName + " feel pain."); } else if (ca.NameIs("True Strike")) { AnimateByDefault(ability.castTime); B.log.RemoveLastLine(); target.effects.Add("True Strike", 10); } else if (ca.NameIs("Marked Prey")) { target.effects.Add("Marked Prey", 7); AnimateByDefault(ability.castTime); log("marks " + target.CommonName + "."); } else if (ca.NameIs("Dirty Fighting")) { AnimateByDefault(ability.castTime); log("throws sand into " + target.CommonName + "'s face!"); target.effects.Add("Blind", 6); } else if (ca.NameIs("Fake Death")) { AnimateByDefault(ability.castTime); B.log.RemoveLastLine(); target.effects.Add("Fake Death", 20); } else if (ca.NameIs("Mind Bond")) { AnimateByDefault(ability.castTime); log("holds " + target.CommonName + "'s mind."); target.effects.Add("Unconscious", 6); t.effects.Add("Sleeping", 6); B.log.RemoveLastLine(); } else if (ca.NameIs("Blindsight")) { AnimateByDefault(ability.castTime); B.log.RemoveLastLine(); target.effects.Add("Blindsight", 6, this); } else if (ca.NameIs("Sleep")) { AnimateByDefault(ability.castTime); B.log.RemoveLastLine(); if (target.HasEffect("Sleeping")) logn(target, "falls asleep within a dream."); if (!t.team.IsEnemyTo(target)) target.hp.AddStamina(1, true); target.effects.Add("Sleeping", 10); } else if (ca.NameIs("Mind Trick")) { AnimateByDefault(ability.castTime); B.log.RemoveLastLine(); target.effects.Add("Mind Tricked", 10, this); } else if (ca.NameIs("Mind Control")) { AnimateByDefault(ability.castTime); B.log.RemoveLastLine(); target.effects.Add("Mind Controlled", 10, this); t.effects.Add("Sleeping", 10); B.log.RemoveLastLine(); } else if (ca.NameIs("Attention")) { target.effects.Add("Attention", 10, this); AnimateByDefault(ability.castTime); log("is now the main object of " + target.CommonName + "'s thoughts."); } else if (ca.NameIs("Prediction")) { target.effects.Add(t.team.IsEnemyTo(target) ? "Destined to Die" : "Destined to Succeed", 10, this); AnimateByDefault(ability.castTime); log("predicts that " + target.CommonName + " will " + (t.team.IsEnemyTo(target) ? "die" : "succeed") + " tonight."); } else if (ca.NameIs("Grimoire Slam")) { Kick(t.p.value, (target.p.value - t.p.value).GetDirection(), 1, false, ability.castTime); target.initiative.Add(-2, ability.castTime, false, true); log("slams " + target.CommonName + " with a book!"); } else if (ca.NameIs("First Aid")) { target.hp.Add(1, true); AnimateByDefault(ability.castTime); log("heals " + target.CommonName + " a little."); } } else if (ability is ItemAbility) { ItemAbility ia = ability as ItemAbility; if (ia.name == "Bash") { t.p.DoDamage(target, 1, false); target.initiative.Add(-6, ability.castTime, false, true); AnimateByDefault(ability.castTime); } } }
public Skills(LocalObject o) : base(o) { }
public void Remove(LocalObject o) { objects.Remove(o); }
public LocalDrawing(LocalObject o) : base(o) { scaling = 1; }
public virtual void Run(LocalObject o) { }
public override void Run(LocalObject o) { o.movement.Move(direction, false); }
public void RememberDamage(LocalObject u, int damage) { if (damageDealt.ContainsKey(u)) damageDealt[u] += damage; else damageDealt.Add(u, damage); }
public Movement(LocalObject o) : base(o) { }
public Fatigue(LocalObject o) : base(o) { value = 0; }
public bool IsFriendTo(LocalObject u) { return u.initiative != null && !IsEnemyTo(u); }
public Team(bool isInPartyi, LocalObject o) : base(o) { isInParty = isInPartyi; }
public ShapeComponent(LocalShape shape, LocalObject o) : base(o) { data = shape; variation = R.Next(data.variations); }
public string GlobalCompile() { string[] FileText = System.IO.File.ReadAllLines(FileName); string FileNamePath = ""; if (FileName.Split('/').Length > 1) { FileNamePath = FileName.Remove(FileName.Length - FileName.Split('/')[FileName.Split('/').Length - 1].Length - 1); } else { FileNamePath = FileName.Remove(FileName.Length - FileName.Split('\\')[FileName.Split('\\').Length - 1].Length - 1); } string[] ConfigLines = System.IO.File.ReadAllLines(FileNamePath + "/config.bk"); string[] DataLines = {}; WebProject CurrenProject = new WebProject(); CurrenProject.ProjectStopWatch.Start(); if (System.IO.File.Exists(FileNamePath + "/data.bk")) { DataLines = System.IO.File.ReadAllLines(FileNamePath + "/data.bk"); for (int i = 0; i < DataLines.Length; i++) { string[] LocalLine = SyntaxTools.GetNewLine(DataLines[i]).Split('='); CurrenProject.AddData(LocalLine[0], LocalLine[1]); } } this.HTML_Path = FileNamePath + ConfigLines[0].Split('=')[1]; VerifyFolder(this.HTML_Path); this.CSS_Path = FileNamePath + ConfigLines[1].Split('=')[1]; VerifyFolder(this.CSS_Path); bool Started = false; WebObject.Base CurrentObject = new WebObject.Base("default", CurrenProject, "", ""); FileLines = new List <string>(); AddFileLines(FileText, FileNamePath); for (int i = 0; i < FileLines.Count; i++) { string[] LinesWords = FileLines[i].Split(' '); if (LinesWords[0] == "page") { CurrentObject = new WebObject.Page(LinesWords[1], CurrenProject, HTML_Path, CSS_Path); Started = true; } else if (LinesWords[0] == "object") { if (LinesWords[1].Split(':').Length > 1) { string[] LocalWords = LinesWords[1].Split(':'); CurrentObject = new WebObject.Base(LocalWords[0], CurrenProject, HTML_Path, CSS_Path); foreach (WebObject.Base LocalObject in CurrenProject.ObjectList) { if (LocalObject.GetName() == LocalWords[1]) { CurrentObject.CSS.SetAllProp(LocalObject, LocalObject.CSS.GetAllProp()); } } } else { CurrentObject = new WebObject.Base(LinesWords[1], CurrenProject, HTML_Path, CSS_Path); } Started = true; } else if (Started && LinesWords[0] == "end") { CurrentObject.CompileObject(); CurrenProject.ObjectList.Add(CurrentObject); Started = false; } else if (Started) { CurrentObject.AddLine(FileLines[i]); } } CurrenProject.DisplayCompileTime(); return("ExitCode = 0"); }
public void Method1(LocalObject param) { Console.WriteLine("Invoked: Method1({0})", param); }
public bool IsAdjacentTo(LocalObject o) { return value.IsAdjacentTo(o.p.value); }
public int DamageDealtBy(LocalObject u) { return damageDealt.ContainsKey(u) ? damageDealt[u] : 0; }
public override void Run(LocalObject o) { o.initiative.Wait(time); }
public LocalComponent(LocalObject o) { t = o; }
public int Distance(LocalObject u) { return MyMath.ManhattanDistance(value, u.p.value); }
public Defence(LocalObject o) : base(o) { }
private void loader_DoWork(object _sender, DoWorkEventArgs e) { if (e.Result != null) { try { using (var dtt = e.Result as DataTable) { if (dtt != null) { dtt.Dispose(); } } e.Result = null; } catch (Exception ex) { Lib.Win.Data.Env.WriteToLog(ex); } } using (DataTable dt = Environment.MessageData.GetDocMessages(DocID, out loader.Cmd)) { var it = new DataTable(); if (loader.CancellationPending) { return; } // adding columns // employees it.Columns.Add(new DataColumn(Environment.MessageData.EmployeesField) { DataType = Type.GetType("System.String") }); // dataMessage it.Columns.Add(new DataColumn(Environment.MessageData.DateMessageField) { DataType = Type.GetType("System.String") }); // title it.Columns.Add(new DataColumn(Environment.MessageData.TitleField) { DataType = Type.GetType("System.Boolean") }); // read it.Columns.Add(new DataColumn(Environment.MessageData.ReadField) { DataType = Type.GetType("System.Boolean") }); // origialEmployees it.Columns.Add(new DataColumn(Environment.MessageData.OriginalEmployeesField) { DataType = Type.GetType("System.String") }); // originalDataMessage it.Columns.Add(new DataColumn(Environment.MessageData.OriginalDateMessageField) { DataType = Type.GetType("System.String") }); // originalDataMessage it.Columns.Add(new DataColumn(Environment.MessageData.DateField) { DataType = Type.GetType("System.DateTime") }); // direction it.Columns.Add(new DataColumn(Environment.MessageData.DirectionField) { DataType = Type.GetType("System.Int32") }); if (loader.CancellationPending) { return; } string oldSender = null; DateTime oldSent = DateTime.MinValue; int lastSenderRowIndex = -1; using (DataTableReader dr = dt.CreateDataReader()) while (!loader.CancellationPending && dr.Read()) { var employeeSenderID = (Int32)dr[Environment.MessageData.DirectionField]; var sender = (string)dr[Environment.MessageData.SenderField]; var recipients = (string)dr[Environment.MessageData.RecipientsField]; var sent = (DateTime)dr[Environment.MessageData.SentField]; var message = (string)dr[Environment.MessageData.NameField]; object obj = dr[Environment.MessageData.ReadField]; bool read = !obj.Equals(DBNull.Value); if (sender != oldSender || sent != oldSent) { // inserting empty line if (it.Rows.Count > 0) { it.Rows.Add(new object[] { "", "", false, true, "", "", DateTime.MinValue, 0 }); } string dateStr = sent.AddHours(LocalObject.GetTimeDiff().Hours).ToString(); it.Rows.Add(new object[] { sender, dateStr, true, true, sender, dateStr, sent, employeeSenderID }); lastSenderRowIndex = it.Rows.Count - 1; } it.Rows.Add(new object[] { recipients, message, false, read, recipients, message, sent, employeeSenderID }); if (!read) { it.Rows[lastSenderRowIndex][3] = read; } } if (loader.CancellationPending) { it.Dispose(); it = null; } e.Result = it; } }
public bool CanSee(LocalObject u) { if (!IsVisible) return false; if (t.HasEffect("Blind") && Distance(u) > 1) return false; if (t.HasEffect("Blindsight") && t.effects.Get("Blindsight").parameter == u) return false; return true; }
public void Add(LocalObject o, ZPoint position = null, bool isInParty = false, bool isAIControlled = false) { o.p = new LocalPosition(o); if (position != null) o.p.Set(position, 0.01f, false); o.drawing = new LocalDrawing(o); if (o.GetCreatureType != null) { o.effects = new Effects(o); o.team = new Team(isInParty, o); o.initiative = new Initiative(isAIControlled, o); o.initiative.Set(ActiveObjects.Count > 0 ? (from q in ActiveObjects select q.initiative.value).Average() : 0, 0.01f, false); } objects.Add(o); }
public void DoDamage(LocalObject o, int damage, bool pure) { bool pastLife = o.hp.value > 0; int finalDamage = pure || t.HasAbility("Prodigious Precision") ? damage : Math.Max(damage - o.hp.Armor, 0); o.hp.Add(-finalDamage, false); o.hp.RememberDamage(t, finalDamage); if (o.hp.value <= 0 && pastLife && t.xp != null && o.shape != null) t.xp.Reward(o.shape.data); B.combatAnimations.Add(new TextAnimation(finalDamage.ToString(), NamedTexture.Get(pure ? "local/pureDamage" : "local/damage"), M.fonts.verdanaBold, Color.White, o.p.GC, 1, true)); }
public bool IsWalkable(ZPoint p, LocalObject t = null) { if (!InRange(p)) return false; LocalObject o = Get(p); if (o != null) return o.p.IsWalkable; else return (t != null && t.HasAbility("Flying")) ? this[p].IsFlat : this[p].IsWalkable; }
public LocalPosition(LocalObject o) : base(o) { r = new RPoint(); animations = new AnimationQueue(); }
public static void Fax0utFillClass(PropertiesFaxDialog dialog, int faxID, DataRow dr) { try { var resources = new ResourceManager(typeof(FaxFillClass)); if (dr == null) { return; } // наличие документа int imageID = 0; object obj = dr[Environment.FaxOutData.DocImageIDField]; if (obj != null && !obj.Equals(DBNull.Value)) { imageID = (int)obj; } FaxPropertyControl fpc; if (imageID > 0) { fpc = new FaxPropertiButtonControl("", resources.GetString("FaxSaved"), 2); ((FaxPropertiButtonControl)fpc).FaxID = faxID; } else { fpc = new FaxPropertyControl("", resources.GetString("FaxNotSave")); } dialog.PutControl(fpc); // описание fpc = new FaxPropertyControl(resources.GetString("Description"), (string)dr[Environment.FaxOutData.DescriptionField]); dialog.PutControl(fpc); // отправлен var date = (DateTime)dr[Environment.FaxOutData.DateField]; fpc = new FaxPropertyControl(resources.GetString("FaxOut"), ObjectToString.Convert(date.ToLocalTime())); dialog.PutControl(fpc); // отправитель fpc = new FaxPropertyControl(resources.GetString("Sender"), (string)dr[Environment.FaxOutData.SenderField]); dialog.PutControl(fpc); // получатель if (Equals(dr[Environment.FaxOutData.RecipField], dr[Environment.FaxOutData.RecvAddressField])) { fpc = new FaxPropertiButtonControl(resources.GetString("Recip"), (string)dr[Environment.FaxOutData.RecipField], 1); } else { fpc = new FaxPropertyControl(resources.GetString("Recip"), (string)dr[Environment.FaxOutData.RecipField]); } dialog.PutControl(fpc); // телефон получателя fpc = new FaxPropertyControl(resources.GetString("RecvAddress"), (string)dr[Environment.FaxOutData.RecvAddressField]); dialog.PutControl(fpc); // CSID fpc = new FaxPropertyControl("CSID:", (string)dr[Environment.FaxOutData.CSIDField]); dialog.PutControl(fpc); // Modem fpc = new FaxPropertyControl(resources.GetString("ModemID"), dr[Environment.FaxOutData.ModemIDField].ToString()); dialog.PutControl(fpc); // скорость передачи string speed = dr[Environment.FaxOutData.SpeedField].ToString(); fpc = new FaxPropertyControl(resources.GetString("Speed"), speed + ((speed.Length > 0) ? " " + resources.GetString("baud") : "")); dialog.PutControl(fpc); // время передачи string duration = dr[Environment.FaxOutData.DurationField].ToString(); fpc = new FaxPropertyControl(resources.GetString("Time"), duration + ((duration.Length > 0) ? " " + resources.GetString("Second") : "")); dialog.PutControl(fpc); // отправлено страниц fpc = new FaxPropertyControl(resources.GetString("PageSentCount"), dr[Environment.FaxOutData.PageSentCountField].ToString()); dialog.PutControl(fpc); // изменил var empID = (int)dr[Environment.FaxInData.EditorField]; var emp = new Employee(empID, Environment.EmpData); fpc = empID > 0 ? new FaxPropertyEdiorControl(resources.GetString("Editor"), emp.LongName, empID) : new FaxPropertyControl(resources.GetString("Editor"), emp.LongName); dialog.PutControl(fpc); // изменено DateTime editDate = (DateTime)dr[Environment.FaxInData.EditedField] + LocalObject.GetTimeDiff(); fpc = new FaxPropertyControl(resources.GetString("Edited"), editDate.ToString()); dialog.PutControl(fpc); dialog.Text = resources.GetString("FaxOutText"); dialog.ResizeForm(); } catch (Exception ex) { Lib.Win.Data.Env.WriteToLog(ex); } }