private void PerformEmote(AgentProperty property, uint value) { if (Game.State == GameState.Playing) { SendAgentPropertyInt(property, value); PerformAnimation(CreatureAnimation.None); } }
protected override void CreateProperties() { if (!_properties.ContainsKey("points")) { AgentProperty points = new AgentProperty("points", 0.0f); properties.Add(points); _properties["points"] = points; } }
public void Save(AgentProperty entity) { if (entity.AgentPropertyId > 0) { _context.AgentProperties.Attach(entity); _context.Entry <AgentProperty>(entity).State = System.Data.EntityState.Modified; } else { _context.AgentProperties.Add(entity); } _context.SaveChanges(); }
/// <summary> /// This is implemented to handle properties as they are parsed from the data stream /// </summary> /// <param name="propertyName">The name of the property.</param> /// <param name="parameters">A string collection containing the parameters and their values. If empty, /// there are no parameters.</param> /// <param name="propertyValue">The value of the property.</param> /// <remarks><para>There may be a mixture of name/value pairs or values alone in the parameters string /// collection. It is up to the derived class to process the parameter list based on the specification /// to which it conforms. For entries that are parameter names, the entry immediately following it in /// the collection is its associated parameter value. The property name, parameter names, and their /// values may be in upper, lower, or mixed case.</para> /// /// <para>The value may be an encoded string. The properties are responsible for any decoding that may /// need to occur (i.e. base 64 encoded image data).</para></remarks> /// <exception cref="PDIParserException">This is thrown if an error is encountered while parsing the data /// stream. Refer to the and inner exceptions for information on the cause of the problem.</exception> protected override void PropertyParser(string propertyName, StringCollection parameters, string propertyValue) { SpecificationVersions version = SpecificationVersions.None; string temp, group = null; int idx; // Parse out the group name if there is one idx = propertyName.IndexOf('.'); if (idx != -1) { group = propertyName.Substring(0, idx).Trim(); propertyName = propertyName.Substring(idx + 1).Trim(); } // The last entry is always CustomProperty so scan for length minus one for (idx = 0; idx < ntv.Length - 1; idx++) { if (ntv[idx].IsMatch(propertyName)) { break; } } // An opening BEGIN:VCARD property must have been seen if (currentCard == null && ntv[idx].EnumValue != PropertyType.Begin) { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseNoBeginProp", "BEGIN:VCARD", propertyName)); } // Handle or create the property switch (ntv[idx].EnumValue) { case PropertyType.Begin: // The value must be VCARD if (String.Compare(propertyValue.Trim(), "VCARD", StringComparison.OrdinalIgnoreCase) != 0) { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnrecognizedTagValue", ntv[idx].Name, propertyValue)); } // NOTE: If serializing into an existing instance, this may not be null. If so, it is // ignored. if (currentCard == null) { currentCard = new VCard(); vCards.Add(currentCard); } currentCard.Group = group; break; case PropertyType.End: // The value must be VCARD if (String.Compare(propertyValue.Trim(), "VCARD", StringComparison.OrdinalIgnoreCase) != 0) { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnrecognizedTagValue", ntv[idx].Name, propertyValue)); } // The group must match too if (currentCard.Group != group) { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnexpectedGroupTag", currentCard.Group, group)); } // When done, we'll propagate the version number to all objects to make it consistent currentCard.PropagateVersion(); // The vCard is added to the collection when created so we don't have to rely on an END:VCARD // to add it. currentCard = null; break; case PropertyType.Profile: // The value must be VCARD if (String.Compare(propertyValue.Trim(), "VCARD", StringComparison.OrdinalIgnoreCase) != 0) { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnrecognizedTagValue", ntv[idx].Name, propertyValue)); } currentCard.AddProfile = true; break; case PropertyType.Version: // Version must be 2.1 or 3.0 temp = propertyValue.Trim(); if (temp == "2.1") { version = SpecificationVersions.vCard21; } else if (temp == "3.0") { version = SpecificationVersions.vCard30; } else { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnrecognizedVersion", "vCard", temp)); } currentCard.Version = version; break; case PropertyType.MimeName: currentCard.MimeName.EncodedValue = propertyValue; break; case PropertyType.MimeSource: currentCard.MimeSource.DeserializeParameters(parameters); currentCard.MimeSource.EncodedValue = propertyValue; break; case PropertyType.ProductId: currentCard.ProductId.EncodedValue = propertyValue; break; case PropertyType.Nickname: currentCard.Nickname.DeserializeParameters(parameters); currentCard.Nickname.EncodedValue = propertyValue; currentCard.Nickname.Group = group; break; case PropertyType.SortString: currentCard.SortString.DeserializeParameters(parameters); currentCard.SortString.EncodedValue = propertyValue; currentCard.SortString.Group = group; break; case PropertyType.Class: currentCard.Classification.EncodedValue = propertyValue; currentCard.Classification.Group = group; break; case PropertyType.Categories: currentCard.Categories.DeserializeParameters(parameters); currentCard.Categories.EncodedValue = propertyValue; currentCard.Categories.Group = group; break; case PropertyType.FormattedName: currentCard.FormattedName.DeserializeParameters(parameters); currentCard.FormattedName.EncodedValue = propertyValue; currentCard.FormattedName.Group = group; break; case PropertyType.Name: currentCard.Name.DeserializeParameters(parameters); currentCard.Name.EncodedValue = propertyValue; currentCard.Name.Group = group; break; case PropertyType.Title: currentCard.Title.DeserializeParameters(parameters); currentCard.Title.EncodedValue = propertyValue; currentCard.Title.Group = group; break; case PropertyType.Role: currentCard.Role.DeserializeParameters(parameters); currentCard.Role.EncodedValue = propertyValue; currentCard.Role.Group = group; break; case PropertyType.Mailer: currentCard.Mailer.DeserializeParameters(parameters); currentCard.Mailer.EncodedValue = propertyValue; currentCard.Mailer.Group = group; break; case PropertyType.Url: currentCard.Url.DeserializeParameters(parameters); currentCard.Url.EncodedValue = propertyValue; currentCard.Url.Group = group; break; case PropertyType.Organization: currentCard.Organization.DeserializeParameters(parameters); currentCard.Organization.EncodedValue = propertyValue; currentCard.Organization.Group = group; break; case PropertyType.UniqueId: currentCard.UniqueId.EncodedValue = propertyValue; currentCard.UniqueId.Group = group; break; case PropertyType.BirthDate: currentCard.BirthDate.DeserializeParameters(parameters); currentCard.BirthDate.EncodedValue = propertyValue; currentCard.BirthDate.Group = group; break; case PropertyType.Revision: currentCard.LastRevision.DeserializeParameters(parameters); currentCard.LastRevision.EncodedValue = propertyValue; currentCard.LastRevision.Group = group; break; case PropertyType.TimeZone: currentCard.TimeZone.DeserializeParameters(parameters); currentCard.TimeZone.EncodedValue = propertyValue; currentCard.TimeZone.Group = group; break; case PropertyType.GeographicPosition: currentCard.GeographicPosition.EncodedValue = propertyValue; currentCard.GeographicPosition.Group = group; break; case PropertyType.PublicKey: currentCard.PublicKey.DeserializeParameters(parameters); currentCard.PublicKey.EncodedValue = propertyValue; currentCard.PublicKey.Group = group; break; case PropertyType.Photo: currentCard.Photo.DeserializeParameters(parameters); currentCard.Photo.EncodedValue = propertyValue; currentCard.Photo.Group = group; break; case PropertyType.Logo: currentCard.Logo.DeserializeParameters(parameters); currentCard.Logo.EncodedValue = propertyValue; currentCard.Logo.Group = group; break; case PropertyType.Sound: currentCard.Sound.DeserializeParameters(parameters); currentCard.Sound.EncodedValue = propertyValue; currentCard.Sound.Group = group; break; case PropertyType.Note: NoteProperty n = new NoteProperty(); n.DeserializeParameters(parameters); n.EncodedValue = propertyValue; n.Group = group; currentCard.Notes.Add(n); break; case PropertyType.Address: AddressProperty a = new AddressProperty(); a.DeserializeParameters(parameters); a.EncodedValue = propertyValue; a.Group = group; currentCard.Addresses.Add(a); break; case PropertyType.Label: LabelProperty l = new LabelProperty(); l.DeserializeParameters(parameters); l.EncodedValue = propertyValue; l.Group = group; currentCard.Labels.Add(l); break; case PropertyType.Telephone: TelephoneProperty t = new TelephoneProperty(); t.DeserializeParameters(parameters); t.EncodedValue = propertyValue; t.Group = group; currentCard.Telephones.Add(t); break; case PropertyType.EMail: EMailProperty e = new EMailProperty(); e.DeserializeParameters(parameters); e.EncodedValue = propertyValue; e.Group = group; currentCard.EMailAddresses.Add(e); break; case PropertyType.Agent: AgentProperty ag = new AgentProperty(); ag.DeserializeParameters(parameters); ag.EncodedValue = propertyValue; ag.Group = group; currentCard.Agents.Add(ag); break; default: // Anything else is a custom property CustomProperty c = new CustomProperty(propertyName); c.DeserializeParameters(parameters); c.EncodedValue = propertyValue; c.Group = group; currentCard.CustomProperties.Add(c); break; } }
internal void SendAgentTargetPropertyFloat(AgentProperty identifier, Agent target, float value) { Network.GameServer.Send(GameServerMessage.AgentTargetPropertyFloat, (uint)identifier, IdManager.GetId(target), IdManager.GetId(this), value); }
internal void SendAgentPropertyInt(AgentProperty identifier, uint value) { Network.GameServer.Send(GameServerMessage.AgentPropertyInt, (uint)identifier, IdManager.GetId(this), value); }
public void Delete(AgentProperty entity) { _context.AgentProperties.Attach(entity); _context.Entry <AgentProperty>(entity).State = System.Data.EntityState.Deleted; _context.SaveChanges(); }
internal void SendAgentTargetPropertyInt(AgentProperty identifier, Agent target, uint value) { Network.GameServer.Send(GameServerMessage.AgentTargetPropertyInt, (uint) identifier, IdManager.GetId(target), IdManager.GetId(this), value); }
internal void SendAgentPropertyFloat(AgentProperty identifier, float value) { Network.GameServer.Send(GameServerMessage.AgentPropertyFloat, (uint) identifier, IdManager.GetId(this), value); }
static void setupScenario(SFSimulator sim) { /* Specify the global time step of the simulation. */ sim.setTimeStep(0.25f); /* Specify the default parameters for agents that are subsequently added. */ AgentProperty ap = new AgentProperty(15.0f, 10, 5.0f, 1.2f, 2.0f, 2.0f, 0.5f, 8, 0.6f, 100, 13.3f, 10, 0.000005f, 0.25f, 1.0f, new Vector2()); sim.setAgentDefaults(ap); /* * Add agents, specifying their start position, and store their goals on the * opposite side of the environment. */ for (int i = 0; i < 5; ++i) { for (int j = 0; j < 5; ++j) { sim.addAgent(new Vector2(55.0f + i * 10.0f, 55.0f + j * 10.0f)); goals.Add(new Vector2(-75.0f, -75.0f)); sim.addAgent(new Vector2(-55.0f - i * 10.0f, 55.0f + j * 10.0f)); goals.Add(new Vector2(75.0f, -75.0f)); sim.addAgent(new Vector2(55.0f + i * 10.0f, -55.0f - j * 10.0f)); goals.Add(new Vector2(-75.0f, 75.0f)); sim.addAgent(new Vector2(-55.0f - i * 10.0f, -55.0f - j * 10.0f)); goals.Add(new Vector2(75.0f, 75.0f)); } } /* * Add (polygonal) obstacles, specifying their vertices in counterclockwise * order. */ List<Vector2> obstacle1 = new List<Vector2>(); List<Vector2> obstacle2= new List<Vector2>(); List<Vector2> obstacle3= new List<Vector2>(); List<Vector2> obstacle4= new List<Vector2>(); obstacle1.Add(new Vector2(-10.0f, 40.0f)); obstacle1.Add(new Vector2(-40.0f, 40.0f)); obstacle1.Add(new Vector2(-40.0f, 10.0f)); obstacle1.Add(new Vector2(-10.0f, 10.0f)); obstacle2.Add(new Vector2(10.0f, 40.0f)); obstacle2.Add(new Vector2(10.0f, 10.0f)); obstacle2.Add(new Vector2(40.0f, 10.0f)); obstacle2.Add(new Vector2(40.0f, 40.0f)); obstacle3.Add(new Vector2(10.0f, -40.0f)); obstacle3.Add(new Vector2(40.0f, -40.0f)); obstacle3.Add(new Vector2(40.0f, -10.0f)); obstacle3.Add(new Vector2(10.0f, -10.0f)); obstacle4.Add(new Vector2(-10.0f, -40.0f)); obstacle4.Add(new Vector2(-10.0f, -10.0f)); obstacle4.Add(new Vector2(-40.0f, -10.0f)); obstacle4.Add(new Vector2(-40.0f, -40.0f)); sim.addObstacle(obstacle1); sim.addObstacle(obstacle2); sim.addObstacle(obstacle3); sim.addObstacle(obstacle4); /* Process the obstacles so that they are accounted for in the simulation. */ sim.processObstacles(); }
static void setupScenario(SFSimulator sim) { // Specify the global time step of the simulation sim.setTimeStep(0.25f); // Specify the default parameters for agents that are subsequently added AgentProperty ap = new AgentProperty(15.0f, 10, 5.0f, 1.2f, 2.0f, 2.0f, 0.5f, 8, 0.6f, 100, 13.3f, 10, 0.000005f, 0.25f, 1.0f, new SFVector2()); sim.setAgentDefaults(ap); // Add agents, specifying their start position, and store their goals on the opposite side of the environment for (int i = 0; i < 5; ++i) { for (int j = 0; j < 5; ++j) { sim.addAgent(new SFVector2(55.0f + i * 10.0f, 55.0f + j * 10.0f)); goals.Add(new SFVector2(-75.0f, -75.0f)); sim.addAgent(new SFVector2(-55.0f - i * 10.0f, 55.0f + j * 10.0f)); goals.Add(new SFVector2(75.0f, -75.0f)); sim.addAgent(new SFVector2(55.0f + i * 10.0f, -55.0f - j * 10.0f)); goals.Add(new SFVector2(-75.0f, 75.0f)); sim.addAgent(new SFVector2(-55.0f - i * 10.0f, -55.0f - j * 10.0f)); goals.Add(new SFVector2(75.0f, 75.0f)); } } // Add (polygonal) obstacles, specifying their vertices in counterclockwise order List <SFVector2> obstacle1 = new List <SFVector2>(); List <SFVector2> obstacle2 = new List <SFVector2>(); List <SFVector2> obstacle3 = new List <SFVector2>(); List <SFVector2> obstacle4 = new List <SFVector2>(); obstacle1.Add(new SFVector2(-10.0f, 40.0f)); obstacle1.Add(new SFVector2(-40.0f, 40.0f)); obstacle1.Add(new SFVector2(-40.0f, 10.0f)); obstacle1.Add(new SFVector2(-10.0f, 10.0f)); obstacle2.Add(new SFVector2(10.0f, 40.0f)); obstacle2.Add(new SFVector2(10.0f, 10.0f)); obstacle2.Add(new SFVector2(40.0f, 10.0f)); obstacle2.Add(new SFVector2(40.0f, 40.0f)); obstacle3.Add(new SFVector2(10.0f, -40.0f)); obstacle3.Add(new SFVector2(40.0f, -40.0f)); obstacle3.Add(new SFVector2(40.0f, -10.0f)); obstacle3.Add(new SFVector2(10.0f, -10.0f)); obstacle4.Add(new SFVector2(-10.0f, -40.0f)); obstacle4.Add(new SFVector2(-10.0f, -10.0f)); obstacle4.Add(new SFVector2(-40.0f, -10.0f)); obstacle4.Add(new SFVector2(-40.0f, -40.0f)); sim.addObstacle(obstacle1); sim.addObstacle(obstacle2); sim.addObstacle(obstacle3); sim.addObstacle(obstacle4); // Process the obstacles so that they are accounted for in the simulation sim.processObstacles(); }