public Player(string name, EntityGender egender, EntityClass eclass) { Name = name; Gender = egender; CharacterClass = eclass; }
public void test_inequality_new_classes() { var item = new EntityClass(); var item2 = new EntityClass(); Assert.IsTrue(item != item2); }
public Player(string name, EntityGender eGender, EntityClass eClass) : base() { Name = name; Gender = eGender; CharacterClass = eClass; }
public void test_get_id_entity_base() { var item = new EntityClass() { Id = Guid.NewGuid() }; var itemInteface = (IEntity)item; Assert.IsTrue(item.Id == (Guid)itemInteface.Id); }
public void test_equality_new_classes() { var item = new EntityClass(); var item2 = new EntityClass(); Assert.IsFalse(item == item2); }
public void is_not_transient_class() { var item = new EntityClass(); item.Id = Guid.NewGuid(); Assert.IsFalse(item.IsTransient()); }
public void test_equality_new_class() { var item = new EntityClass(); #pragma warning disable 1718 Assert.IsTrue(item == item); #pragma warning restore 1718 }
public Player(string name, EntityGender eGender, EntityClass eClass, int estr, int edex, int ewis, int eint) { Name = name; Gender = eGender; CharacterClass = eClass; Strength = estr; Dexterity = edex; Wisdom = ewis; Intelligence = eint; }
private static void CreateExceptionInfoEntity( IProject project ) { EntityClass exception = new EntityClass( "ExceptionInfo", "public" ); EntityField id = new EntityField( "id" ); id.IsPrimaryKey = true; id.IsPreview = true; id.Type = intType; EntityField name = new EntityField( "name" ); name.MaxSize = 15000; name.IsRequired = true; name.Type = stringType; EntityField message = new EntityField( "message" ); message.Represents = true; message.IsPreview = true; message.IsRequired = true; message.MaxSize = 15000; message.Type = stringType; EntityField date = new EntityField( "date" ); date.Type = dateTimeType; EntityField exceptions = new EntityField( "exceptions" ); exceptions.Mult = Multiplicity.OneToMany; exceptions.Type = exception; EntityField principal = null; principal = new EntityField( "principal" ); principal.Mult = Multiplicity.ManyToOne; EntityClass principalEntity = project.GetEntity( "Principal" ); principalEntity.Fields.Add( exceptions ); principal.Type = principalEntity; EntityField url = new EntityField( "url" ); url.Regex.Add( "$http://" ); url.MaxSize = 15000; url.Type = stringType; EntityField stackTrace = new EntityField( "stackTrace" ); stackTrace.MaxSize = 15000; stackTrace.IsRequired = true; stackTrace.Type = stringType; exception.AddField( id ); exception.AddField( name ); exception.AddField( message ); exception.AddField( date ); exception.AddField( principal ); exception.AddField( url ); exception.AddField( stackTrace ); project.Model.Add( exception ); }
public Player(string name, EntityGender egender, EntityClass eclass, int dexterity, int health, int strength, int wisdom) { Name = name; Gender = egender; CharacterClass = eclass; Dexterity = dexterity; Health = health; Strength = strength; Wisdom = wisdom; }
public void should_return_entity_if_found() { var dataRepository = new DataRepository(); var entity = new EntityClass(); dataRepository.Save(entity); var scenario = BindingScenario<Model>.For(d => { d.Service<IRepository>(dataRepository); d.BindWith(binder); d.Data(m => m.Entity, entity.Id.ToString()); }); scenario.Problems.ShouldHaveCount(0); scenario.Model.Entity.ShouldBeTheSameAs(entity); }
public static string GetEntityClass(EntityClass entityClass) { string cls = "person"; switch (entityClass) { case EntityClass.PERSON: cls = "person"; break; case EntityClass.PLACE: cls = "place"; break; } return cls; }
private void SetupConnection(EntityClass logger, EntityClass principal) { EntityField principalRef = new EntityField(); principalRef.Name = "principal"; principalRef.IsRequired = false; principalRef.Mult = Multiplicity.ManyToOne; principalRef.Type = principal; logger.Fields.Add(principalRef); EntityField loggerRef = new EntityField(); loggerRef.Name = "Requests"; loggerRef.Type = logger; loggerRef.Mult = Multiplicity.OneToMany; principal.Fields.Add(loggerRef); }
public void ThatASessionFactoryCanBuildASqliteDatabaseShema() { var entityClass = new EntityClass(); var sessionFactory = SessionFactoryManager.GetSessionFactory("Test"); var session = sessionFactory.OpenSession(); CurrentSessionContext.Bind(session); SessionFactoryManager.BuildSchema("Test", session); var tables = ((SQLiteConnection)session.Connection).GetSchema("Columns", new[] { null, null, "EntityClass" }); foreach (DataRow test in tables.Rows) { var d = (string) test["column_name"]; } CurrentSessionContext.Unbind(sessionFactory); session.Close(); }
public override void Init(EntityAlive _theEntity) { base.Init(_theEntity); MutexBits = 3; executeDelay = 0.5f; // There is too many values that we need to read in from the entity, so we'll read them directly from the entityclass EntityClass entityClass = EntityClass.list[_theEntity.entityClass]; lstHomeBlocks = ConfigureEntityClass("HomeBlocks", entityClass); lstSanitation = ConfigureEntityClass("ToiletBlocks", entityClass); lstSanitationBuffs = ConfigureEntityClass("SanitationBuffs", entityClass); if (entityClass.Properties.Values.ContainsKey("SanitationBlock")) { strSanitationBlock = entityClass.Properties.Values["SanitationBlock"]; } lstBeds = ConfigureEntityClass("Beds", entityClass); lstProductionBuffs = ConfigureEntityClass("ProductionFinishedBuff", entityClass); if (entityClass.Properties.Classes.ContainsKey("ProductionItems")) { DynamicProperties dynamicProperties3 = entityClass.Properties.Classes["ProductionItems"]; foreach (KeyValuePair <string, object> keyValuePair in dynamicProperties3.Values.Dict.Dict) { ProductionItem item = new ProductionItem(); item.item = ItemClass.GetItem(keyValuePair.Key, false); item.Count = int.Parse(dynamicProperties3.Values[keyValuePair.Key]); String strCvar = "Nothing"; if (dynamicProperties3.Params1.TryGetValue(keyValuePair.Key, out strCvar)) { item.cvar = strCvar; } lstProductionItem.Add(item); DisplayLog("Adding Production Item: " + keyValuePair.Key + " with a count of: " + item.Count + " and will reset: " + strCvar); } } }
public override void Init(int _entityClass) { base.Init(_entityClass); // Sets the hand value, so we can give our entities ranged weapons. this.inventory.SetSlots(new ItemStack[] { new ItemStack(this.inventory.GetBareHandItemValue(), 1) }); EntityClass entityClass = EntityClass.list[_entityClass]; if (entityClass.Properties.Values.ContainsKey("Demeanor")) { this.strDemeanor = entityClass.Properties.Values["Demeanor"].ToString(); } }
public override bool CheckRequirement(EntityPlayer player) { int entityID = 0; if (player.Buffs.HasCustomVar("CurrentNPC")) { entityID = (int)player.Buffs.GetCustomVar("CurrentNPC"); } if (entityID == 0) { return(false); } EntityAliveSDX myEntity = player.world.GetEntity(entityID) as EntityAliveSDX; if (myEntity != null) { string text2; EntityClass entityClass = EntityClass.list[myEntity.entityClass]; for (int x = 1; x < 20; x++) { string text = EntityClass.PropAITask + x; if (entityClass.Properties.Values.ContainsKey(text)) { if (entityClass.Properties.Values.TryGetString(text, out text2) || text2.Length > 0) { if (text2.Contains(base.Value)) { return(true); } continue; } } else { return(false); } } } return(false); }
private void BuildChannel(EntityClass channel) { EntityField channelId = new EntityField("id"); channelId.IsRequired = true; channelId.IsPrimaryKey = true; channelId.IsPreview = true; channelId.Type = intEntity; channel.Fields.Add(channelId); EntityField channelName = new EntityField("name"); channelName.IsPreview = true; channelName.IsRequired = true; channelName.Represents = true; channelName.Type = stringEntity; channel.Fields.Add(channelName); }
/// <summary> /// Shows the properties of the specified <see cref="EntityClass"/>.</summary> /// <param name="entityClass"> /// The <see cref="EntityClass"/> whose properties to show.</param> /// <remarks><para> /// <b>ShowEntityClass</b> merely clears the contents of the <see cref="PropertyListView"/> /// if the specified <paramref name="entityClass"/> or the current <see /// cref="MasterSection"/> instance is a null reference. /// </para><para> /// Otherwise, <b>ShowEntityClass</b> adds one row for each attribute, instance resource, /// build resource, and ability (in that order) defined by the specified <paramref /// name="entityClass"/>.</para></remarks> public void ShowEntityClass(EntityClass entityClass) { Items.Clear(); // just clear display if nothing to show if (MasterSection.Instance == null || entityClass == null) { return; } // show entity class variables CreateVariableRows(entityClass, VariableCategory.Attribute, false); CreateVariableRows(entityClass, VariableCategory.Resource, false); CreateVariableRows(entityClass, VariableCategory.Resource, true); // show entity class abilities CreateAbilityRows(entityClass); }
public static bool AllowedRandomSize(EntityAlive entity) { bool bRandomSize = false; if (entity is EntityZombie) { bRandomSize = true; } EntityClass entityClass = EntityClass.list[entity.entityClass]; if (entityClass.Properties.Values.ContainsKey("RandomSize")) { bRandomSize = StringParsers.ParseBool(entityClass.Properties.Values["RandomSize"], 0, -1, true); } return(bRandomSize); }
public IEnumerator Attack(EntityClass ec) { //Debug.Log("attacks"); tilAttack = 1; GetComponent <Animator>().SetBool("Attack", true); yield return(new WaitForEndOfFrame()); GetComponent <Animator>().SetBool("Attack", false); yield return(new WaitForSeconds(.2f)); if (inside.Contains(ec.ecgetObject().GetComponent <CapsuleCollider2D>())) { ec.getHit(dmg, "melee"); ec.ecgetObject().GetComponent <Rigidbody2D>().AddForce((ec.ecgetObject().transform.position - transform.position) * 100, ForceMode2D.Force); ec.ecgetObject().GetComponent <MovementScript>().timeTilmovement += .2f; } attacking = false; }
private HashSet <int> GenerateLists(EntityClass entityClass, string strAnimationType) { var hash = new HashSet <int>(); Log("Searching for AnimationType: " + strAnimationType); if (entityClass.Properties.Values.ContainsKey(strAnimationType)) { Log("Animation Type found: " + entityClass.Properties.Values[strAnimationType].ToString()); foreach (var strAnimationState in entityClass.Properties.Values[strAnimationType].Split(',')) { Log("Adding Attack Hash: " + strAnimationState.Trim()); hash.Add(Animator.StringToHash(strAnimationState.Trim())); AttackStrings.Add(strAnimationState); } } return(hash); }
/// <summary>代码生成测试</summary> /// <param name="dal"></param> public static void CodeTest(DAL dal) { //XTable table = dal.Tables[0]; //foreach (XTable item in dal.Tables) //{ // if (item.Name == "Area") // { // table = item; // break; // } //} EntityAssembly asm = new EntityAssembly(); asm.Dal = dal; asm.NameSpace = new System.CodeDom.CodeNamespace("XCode.Test.Entities"); //EntityClass entity = asm.Create(table); //entity.Create(); //entity.AddProperties(); //entity.AddIndexs(); //entity.AddNames(); EntityClass entity = asm.Create("Area"); String str = entity.GenerateCSharpCode(); Console.WriteLine(str); CompilerResults rs = asm.Compile(null); foreach (String item in rs.Output) { Console.WriteLine(item); } //asm.CreateAll(); //str = asm.GenerateCSharpCode(); ////File.WriteAllText(dal.ConnName + ".cs", str); //Console.WriteLine(str); }
private void TemplateClassTests(string output, EntityClass entity) { Dictionary <string, object> param = new Dictionary <string, object>(); RelationDependencyFactory depFactory = new RelationDependencyFactory(); RelationDependency dep = depFactory.create(entity, Project.Model); param.Add("entity", entity); param.Add("namespace", Project.Name + "." + ComponentType.Tests.ToString()); param.Add("entityClass", (EntityClass)entity); param.Add("coreName", Project.Name.ToString() + "." + ComponentType.Core.ToString()); param.Add("dataName", Project.Name.ToString() + "." + ComponentType.DataAccessLayer.ToString()); param.Add("dep", dep); param.Add("depsWhithDeclaration", DependenciesString(dep)); param.Add("depsWhithoutDeclaration", DependenciesWhithoutDeclarationString(dep)); string template = GetResource("BaseClassTestsTemplate.vtl"); Templates.Generate(template, output, param); }
public static bool AllowedRandomSize(EntityAlive entity) { bool bRandomSize = false; if (entity is EntityZombie) { AdvLogging.DisplayLog(AdvFeatureClass, " Random Size: Is A Zombie. Random size is true"); bRandomSize = true; } EntityClass entityClass = EntityClass.list[entity.entityClass]; if (entityClass.Properties.Values.ContainsKey("RandomSize")) { bRandomSize = StringParsers.ParseBool(entityClass.Properties.Values["RandomSize"], 0, -1, true); } AdvLogging.DisplayLog(AdvFeatureClass, "Entity: " + entity.DebugNameInfo + " Random Size: " + bRandomSize); return(bRandomSize); }
private void dg_CellEditEnded(object sender, DataGridCellEditEndedEventArgs e) { EntityClass entity = (EntityClass)e.Row.DataContext; // コンボボックスID連動 switch (e.Column.DisplayIndex) { case 2: // 表示区分 if (_entity == null) { return; } if (_entity.Count >= dg.SelectedIndex && dg.SelectedIndex != -1) { _entity[dg.SelectedIndex]._display_division_id = MeiNameList.GetID(MeiNameList.geNameKbn.DISPLAY_DIVISION_ID, ExCast.zCStr(entity._display_division_nm)) - 1; } break; } }
public static ItemValue GetItemValue(int EntityID, String strProperty) { ItemValue result = ItemClass.GetItem("casinoCoin", false); EntityAliveSDX myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAliveSDX; if (myEntity) { EntityClass entityClass = EntityClass.list[myEntity.entityClass]; if (entityClass.Properties.Values.ContainsKey(strProperty)) { result = ItemClass.GetItem(entityClass.Properties.Values[strProperty], false); } if (result.IsEmpty()) { result = ItemClass.GetItem("casinoCoin", false); } } return(result); }
public override string[] ToColumns(string alias, string propertyName) { if (EntityClass.Equals(propertyName)) { // This doesn't actually seem to work but it *might* // work on some dbs. Also it doesn't work if there // are multiple columns of results because it // is not accounting for the suffix: // return new String[] { getDiscriminatorColumnName() }; //TODO: this will need to be changed to return a SqlString but for now the SqlString // is being converted to a string for existing interfaces to work. return(new string[] { DiscriminatorFragment(alias).ToSqlStringFragment() }); } else { return(base.ToColumns(alias, propertyName)); } }
public static void ReturnItem(ClientInfo _cInfo) { foreach (ItemStack _item in _stacks) { ItemValue _itemValue = _item.itemValue; if (_itemValue != null && !_itemValue.Equals(ItemValue.None)) { int _quality = 1; if (_itemValue.HasQuality) { _quality = _itemValue.Quality; } string _itemName = ItemClass.list[_itemValue.type].GetItemName(); ItemValue itemValue = new ItemValue(ItemClass.GetItem(_itemName).type, _quality, _quality, true); World world = GameManager.Instance.World; if (world.Players.dict[_cInfo.entityId].IsSpawned()) { var entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData { entityClass = EntityClass.FromString("item"), id = EntityFactory.nextEntityID++, itemStack = new ItemStack(itemValue, _item.count), pos = world.Players.dict[_cInfo.entityId].position, rot = new Vector3(20f, 0f, 20f), lifetime = 60f, belongsPlayerId = _cInfo.entityId }); world.SpawnEntityInWorld(entityItem); _cInfo.SendPackage(new NetPackageEntityCollect(entityItem.entityId, _cInfo.entityId)); world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Killed); } } } string _phrase770; if (!Phrases.Dict.TryGetValue(770, out _phrase770)) { _phrase770 = "The items from your dropped bag were sent to your inventory. If your bag is full, check the ground."; } _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase770), Config.Server_Response_Name, false, "ServerTools", false)); LastBagPos.Remove(_cInfo.entityId); Que(); }
private static void RandomItem(ClientInfo _cInfo) { try { string _randomItem = list.RandomObject(); ItemValue _itemValue = new ItemValue(ItemClass.GetItem(_randomItem, false).type, false); int[] _itemData; if (Dict.TryGetValue(_randomItem, out _itemData)) { int _count = 0; if (_itemData[0] > _itemData[1]) { _count = random.Next(_itemData[1], _itemData[0] + 1); } else { _count = random.Next(_itemData[0], _itemData[1] + 1); } if (_itemValue.HasQuality && _itemData[2] > 0 && _itemData[3] >= _itemData[2]) { _itemValue.Quality = random.Next(_itemData[2], _itemData[3] + 1); } World world = GameManager.Instance.World; var entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData { entityClass = EntityClass.FromString("item"), id = EntityFactory.nextEntityID++, itemStack = new ItemStack(_itemValue, _count), pos = world.Players.dict[_cInfo.entityId].position, rot = new Vector3(20f, 0f, 20f), lifetime = 60f, belongsPlayerId = _cInfo.entityId }); world.SpawnEntityInWorld(entityItem); _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageEntityCollect>().Setup(entityItem.entityId, _cInfo.entityId)); world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Despawned); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in BloodmoonWarrior.RandomItem: {0}", e.Message)); } }
public void SpawnFromGroup(String strGroup, int Count) { int EntityID = -1; for (int x = 0; x < this.MaxSpawn; x++) { // Verify that it's an entity group or individual entity.. just in case. if (EntityGroups.list.ContainsKey(strGroup)) { DisplayLog(" Spawning from : " + strGroup); EntityID = EntityGroups.GetRandomFromGroup(strGroup); SpawnEntity(EntityID, false); } else { SpawnEntity(EntityClass.FromString(strGroup), false); } } }
public static void ShopPurchase(ClientInfo _cInfo, string _itemName, string _secondaryName, int _count, int _quality, int _price, int currentCoins) { World world = GameManager.Instance.World; ItemValue _itemValue = new ItemValue(ItemClass.GetItem(_itemName).type, _quality, _quality, false, null, 1); int _maxAllowed = _itemValue.ItemClass.Stacknumber.Value; if (_count <= _maxAllowed) { var entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData { entityClass = EntityClass.FromString("item"), id = EntityFactory.nextEntityID++, itemStack = new ItemStack(_itemValue, _count), pos = world.Players.dict[_cInfo.entityId].position, rot = new Vector3(20f, 0f, 20f), lifetime = 60f, belongsPlayerId = _cInfo.entityId }); world.SpawnEntityInWorld(entityItem); _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageEntityCollect>().Setup(entityItem.entityId, _cInfo.entityId)); world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Despawned); Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _price); Log.Out(string.Format("Sold {0} to {1}", _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.Name, _cInfo.playerName)); string _message = "{Count} {Item} was purchased through the shop. If your bag is full, check the ground."; _message = _message.Replace("{Count}", _count.ToString()); if (_secondaryName != "") { _message = _message.Replace("{Item}", _secondaryName); } else { _message = _message.Replace("{Item}", _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.Name); } ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { string _message = "You can only purchase a full stack worth at a time. The maximum stack size for this is {Max}."; _message = _message.Replace("{Max}", _maxAllowed.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
private static void BuildClassTestModel() { EntityInterface iPerson = GetInterface(); EntityClass parent = new EntityClass(); parent.Name = "Pai"; EntityClass category = new EntityClass(); category.Name = "Category"; category.Visibility = "public"; category.Interfaces.Add(iPerson); category.Parent = parent; EntityField field = new EntityField(); field.Name = "Id"; field.Visibility = "protected"; field.IsPrimaryKey = true; field.Type = new Int(); category.Fields.Add(field); field = new EntityField(); field.Name = "Description"; field.IsRequired = true; field.MaxSize = 500; field.Type = new Loki.DataRepresentation.IntrinsicEntities.String(); category.Fields.Add(field); category.IsAbstract = true; category.Persistable = true; category.Visibility = "protected"; EntityMethod init = new EntityMethod(); init.Name = "Init"; category.Methods.Add(init); Model list = new Model(); list.Add(category); classes.Model = list; }
// Token: 0x060000AA RID: 170 RVA: 0x00007618 File Offset: 0x00006618 public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale) { this.MarkToUnload(); int result; if (this.world.IsRemote()) { Debug.Log("World is remote, not spawning."); result = 1; } else { if (this.particleOnDeath != null && this.particleOnDeath.Length > 0) { EntityClass entityClass = EntityClass.list[this.entityClass]; this.AddParticle(entityClass); } if (this.isGameMessageOnDeath()) { GameManager.Instance.GameMessage(EnumGameMessages.EntityWasKilled, this, this.entityThatKilledMe); } int classID = 0; Entity entity = EntityFactory.CreateEntity(EntityGroups.GetRandomFromGroup("santaspawn", ref classID), this.position); if (entity == null) { Debug.Log("No bad santa spawn"); result = 1; } else { Vector3i blockPos = default(Vector3i); blockPos.x = (int)this.position.x; blockPos.y = (int)this.position.y; blockPos.z = (int)this.position.z; this.world.SetBlockRPC(blockPos, BlockValue.Air); entity.SetSpawnerSource(EnumSpawnerSource.StaticSpawner); GameManager.Instance.World.SpawnEntityInWorld(entity); result = 0; } } return(result); }
private void GetAITasks(EntityClass ec) { var i = 1; while (ec.Properties.Values.ContainsKey(EntityClass.PropAITask + i)) { AITasks.Add(new BCMDynamicProp(new[] { EntityClass.PropAITask + i, ec.Properties.Values[EntityClass.PropAITask + i], ec.Properties.Params1.ContainsKey(EntityClass.PropAITask + i) ? ec.Properties.Params1[EntityClass.PropAITask + i] : "", ec.Properties.Params2.ContainsKey(EntityClass.PropAITask + i) ? ec.Properties.Params2[EntityClass.PropAITask + i] : "" })); i++; } Bin.Add("AITasks", AITasks); }
public void withdraw_money(int method) { Console.WriteLine(); Console.Write(" --> ENTER ACCOUNT NUMBER : "); int account_no = int.Parse(Console.ReadLine()); Console.Write(" --> ENTER AMOUNT TO BE WITHDRAW : "); int amount = int.Parse(Console.ReadLine()); if (method == 1) { Class1 deposite_money_object = new Class1(); deposite_money_object.withdraw_myBankDB(account_no, amount); } if (method == 2) { EntityClass my_ENTITY_object = new EntityClass(); my_ENTITY_object.withdraw_myBankDB(account_no, amount); } }
/// <summary> /// Adds <see cref="ImageStack"/> and <see cref="Frames"/> elements from the specified <see /// cref="EntityTemplate"/>.</summary> /// <param name="template"> /// The <see cref="EntityTemplate"/> to show.</param> /// <remarks><para> /// <b>AddEntityTemplate</b> adds the entire <see cref="EntityClass.ImageStack"/> and the /// <see cref="EntityTemplate.FrameOffset"/> value of the specified <paramref /// name="template"/> to the <see cref="ImageStack"/> and <see cref="Frames"/> collections, /// respectively. /// </para><para> /// If the <see cref="ImageStackEntry.SingleFrame"/> value of an <see cref="ImageStack"/> /// element is non-negative, that value is added to the corresponding index positions in the /// <see cref="Frames"/> collection instead. /// </para><para> /// <b>AddEntityTemplate</b> adds an empty <see cref="ImageStackEntry"/> to /// <b>ImageStack</b> and the value zero to <b>Frames</b> if <paramref name="template"/> /// does not reference a valid entity class.</para></remarks> private void AddEntityTemplate(EntityTemplate template) { // get associated entity class EntityClass entityClass = MasterSection.Instance.Entities.GetEntity(template); // empty stack entry shows "invalid" icon if (entityClass == null) { this._imageStack.Add(new ImageStackEntry()); this._frames.Add(0); return; } // show all images with frame offset foreach (ImageStackEntry entry in entityClass.ImageStack) { this._imageStack.Add(entry); // Image may be null this._frames.Add(entry.SingleFrame < 0 ? template.FrameOffset : entry.SingleFrame); } }
private List <EntityField> GetFields(EntityClass e) { List <EntityField> fields = new List <EntityField>(); do { foreach (EntityField field in e.Fields) { if (!e.RootEntity && field.Name == "id") { continue; } fields.Add(field); } e = (EntityClass)e.Parent; } while(e != null); return(fields); }
public static void Send(ClientInfo _cInfo) { if (StartingItems.ItemList.Count > 0) { World world = GameManager.Instance.World; List <string> _itemList = StartingItems.ItemList.Keys.ToList(); for (int i = 0; i < _itemList.Count; i++) { string _item = _itemList[i]; int[] _itemData; StartingItems.ItemList.TryGetValue(_item, out _itemData); ItemValue _itemValue = new ItemValue(ItemClass.GetItem(_item, false).type, false); if (_itemValue.HasQuality && _itemData[1] > 0) { _itemValue.Quality = _itemData[1]; } EntityItem entityItem = new EntityItem(); entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData { entityClass = EntityClass.FromString("item"), id = EntityFactory.nextEntityID++, itemStack = new ItemStack(_itemValue, _itemData[0]), pos = world.Players.dict[_cInfo.entityId].position, rot = new Vector3(20f, 0f, 20f), lifetime = 60f, belongsPlayerId = _cInfo.entityId }); world.SpawnEntityInWorld(entityItem); _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageEntityCollect>().Setup(entityItem.entityId, _cInfo.entityId)); world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Killed); SdtdConsole.Instance.Output(string.Format("Spawned starting item {0} for {1}.", _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.Name, _cInfo.playerName)); Log.Out(string.Format("[SERVERTOOLS] Spawned starting item {0} for {1}", _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.Name, _cInfo.playerName)); } string _phrase806; if (!Phrases.Dict.TryGetValue(806, out _phrase806)) { _phrase806 = " you have received the starting items. Check your inventory. If full, check the ground."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase806 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
private void BuildEntry(EntityClass entry) { EntityField id = new EntityField("id"); id.IsPreview = true; id.IsRequired = true; id.Represents = true; id.IsPrimaryKey = true; id.Type = intEntity; entry.Fields.Add(id); EntityField text = new EntityField("text"); text.IsPreview = false; text.Represents = false; text.Type = stringEntity; text.MaxSize = 3000; entry.Fields.Add(text); EntityField date = new EntityField("date"); date.IsPreview = true; date.Type = dateTimeEntity; entry.Fields.Add(date); EntityClass principal = (EntityClass)Project.Model.GetByName("Principal"); EntityField principalField = new EntityField("Principal"); principalField.IsPreview = false; principalField.Represents = true; principalField.Type = principal; principalField.Mult = Multiplicity.ManyToOne; entry.Fields.Add(principalField); EntityField principalEntries = new EntityField("ChannelEntries"); principalEntries.Type = entry; principalEntries.Mult = Multiplicity.OneToMany; principal.Fields.Add(principalEntries); }
public static void firstClaim(ClientInfo _cInfo) { string _sql = string.Format("SELECT firstClaim FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); bool _firstClaim; bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _firstClaim); _result.Dispose(); if (!_firstClaim) { World world = GameManager.Instance.World; string claimBlock = "keystoneBlock"; ItemValue itemValue; itemValue = new ItemValue(ItemClass.GetItem(claimBlock).type, 1, 1, true); if (Equals(itemValue, ItemValue.None)) { SdtdConsole.Instance.Output(string.Format("Unable to find block {0} for /claim command", claimBlock)); } var entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData { entityClass = EntityClass.FromString("item"), id = EntityFactory.nextEntityID++, itemStack = new ItemStack(itemValue, 1), pos = world.Players.dict[_cInfo.entityId].position, rot = new Vector3(20f, 0f, 20f), lifetime = 60f, belongsPlayerId = _cInfo.entityId }); world.SpawnEntityInWorld(entityItem); _cInfo.SendPackage(new NetPackageEntityCollect(entityItem.entityId, _cInfo.entityId)); world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Killed); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", claim block has been added to your inventory or if inventory is full, it dropped at your feet.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); _sql = string.Format("UPDATE Players SET firstClaim = 'true' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); } else { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you have already received your first claim block. Contact an administrator if you require help.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } }
/// <summary> /// Shows the current faction resources and those required to build the specified <see /// cref="EntityClass"/> in the "Resource" <see cref="ListView"/>.</summary> /// <param name="entityClass"> /// The <see cref="EntityClass"/> whose resource counts to show. This argument may be a null /// reference.</param> /// <remarks><para> /// <b>ShowResources</b> updates the "Resource" list view with the current resources of the /// <see cref="WorldState.ActiveFaction"/>, and those required to build the specified /// <paramref name="entityClass"/>, if valid. /// </para><para> /// For each resource row, the "Current" column shows the matching value in the faction's /// <see cref="Faction.Resources"/> collection, and the "Build" column shows the matching /// value, if any, in the collection returned by <see cref="Faction.GetBuildResources"/> for /// the specified <paramref name="entityClass"/>.</para></remarks> private void ShowResources(EntityClass entityClass) { // retrieve required resources for entity class Faction faction = this._faction; VariableValueDictionary buildResources = (entityClass == null ? null : faction.GetBuildResources(this._worldState, entityClass)); foreach (BuildListItem item in ResourceList.Items) { // show available resources in "Current" column Variable current = faction.Resources[item.ResourceClass.Id]; if (current == null) { item.CurrentCount = 0; item.CurrentText = "—"; // em dash } else { item.CurrentCount = current.Value; item.CurrentText = current.ToString(); } // show required resources in "Build" column int index = (buildResources == null ? -1 : buildResources.IndexOfKey(item.ResourceClass.Id)); if (index < 0) { item.BuildCount = 0; item.BuildText = "—"; // em dash } else { int required = buildResources.GetByIndex(index); item.BuildCount = required; item.BuildText = item.ResourceClass.Format(required, false); } } ResourceList.Items.Refresh(); }
/// <summary> /// Handles the <see cref="Selector.SelectionChanged"/> event for the "Entity Class" <see /// cref="ListView"/>.</summary> /// <param name="sender"> /// The <see cref="Object"/> where the event handler is attached.</param> /// <param name="args"> /// A <see cref="SelectionChangedEventArgs"/> object containing event data.</param> /// <remarks> /// <b>OnEntitySelected</b> updates all dialog controls to reflect the selected item in the /// "Entity Class" list view.</remarks> private void OnEntitySelected(object sender, SelectionChangedEventArgs args) { args.Handled = true; // clear data display this._tileBuffer.Clear(); EntityInfo.Clear(); PropertyList.ShowEntityClass(null); // retrieve selected item, if any EntityClass entityClass = EntityList.SelectedItem as EntityClass; if (entityClass == null) { return; } // set new frame index range FrameScrollBar.Minimum = 0; FrameScrollBar.Maximum = Math.Max(entityClass.FrameCount - 1, 0); FrameScrollBar.SmallChange = 1; // show first or specified frame int value = (entityClass == this._entityClass ? this._frameOffset : 0); // change index, or redraw manually if unchanged if (FrameScrollBar.Value != value) { FrameScrollBar.Value = value; } else { ShowFrame(entityClass, value); } // show entity class properties PropertyList.ShowEntityClass(entityClass); // show associated informational text EntityInfo.Text = String.Join(Environment.NewLine, entityClass.Paragraphs); }
public override void DataSelect(int intKbn, object objList) { switch ((ExWebService.geWebServiceCallKbn)intKbn) { case _GetWebServiceCallKbn: if (objList != null) { _entity = (ObservableCollection<EntityClass>)objList; EntityClass entity = new EntityClass(); // 明細初期設定 InitDetail(ref entity); _entity.Add(entity); SetDetailRecNo(); this.dg.ItemsSource = _entity; if (ExCast.zCInt(_entity[0]._lock_flg) == 0) { this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd; ExBackgroundWorker.DoWork_Focus(this.dg, 100); ExBackgroundWorker.DoWork_SelectedIndex(this.dg, 200, 0); ExBackgroundWorker.DoWork_DataGridColum(this.dg, 300, dg.Columns[0]); ExBackgroundWorker.DoWork_DataGridColum(this.dg, 500, dg.Columns[0]); } else { this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel; } } else { _entity = new ObservableCollection<EntityClass>(); if (!string.IsNullOrEmpty(this.utlClass.txtBindID.Text.Trim()) && !string.IsNullOrEmpty(this.utlClass.txtNm.Text.Trim())) { EntityClass entity = new EntityClass(); // 明細初期設定 InitDetail(ref entity); _entity.Add(entity); SetDetailRecNo(); this.dg.ItemsSource = _entity; this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd; ExBackgroundWorker.DoWork_Focus(this.dg, 100); ExBackgroundWorker.DoWork_SelectedIndex(this.dg, 400, 0); ExBackgroundWorker.DoWork_DataGridColum(this.dg, 500, dg.Columns[0]); } else { this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Init; SetDetailRecNo(); this.dg.ItemsSource = _entity; ExBackgroundWorker.DoWork_Focus(this.utlClass.txtBindID, 100); } } break; default: break; } }
public void is_transient_class() { var item = new EntityClass(); Assert.IsTrue(item.IsTransient()); }
public void test_equality_invalid_object() { var item = new EntityClass(); Assert.IsFalse(item.Equals(new object())); }
public void test_get_hash_code_no_transient_entity() { var item = new EntityClass() { Id = Guid.NewGuid() }; var hash = item.GetHashCode(); }
private static EntityClass CreateRoleEntity( IProject project, EntityClass principal ) { EntityClass role = new EntityClass( "Roles", "public" ); EntityField id = new EntityField( "id" ); id.IsPrimaryKey = true; id.IsPreview = true; id.Type = intType; EntityField name = new EntityField( "name" ); name.MaxSize = 20; name.IsRequired = true; name.Represents = true; name.IsPreview = true; name.Type = stringType; EntityField user = new EntityField( "users" ); user.Type = principal; user.Mult = Multiplicity.ManyToMany; user.InfoOnly = true; role.AddField( id ); role.AddField( name ); role.AddField( user ); project.Model.Add( role ); return role; }
public void test_get_hash_code_transient_entity() { var item = new EntityClass(); var hash = item.GetHashCode(); }
private static void CreatePrincipalEntity( IProject project ) { EntityClass principal = project.GetEntity( "Principal" ); if( principal == null ) { principal = new EntityClass( "Principal", "public" ); EntityField id = new EntityField( "id" ); id.IsPrimaryKey = true; id.Type = intType; id.IsPreview = true; principal.AddField( id ); project.Model.Add( principal ); } principal.Lazy = true; if( !principal.HasField( "name" ) ) { EntityField name = new EntityField( "name" ); name.MaxSize = 200; name.IsRequired = true; name.IsPreview = true; name.Represents = true; name.Type = stringType; principal.AddField( name ); } if( !principal.HasField( "password" ) ) { EntityField password = new EntityField( "password" ); password.MaxSize = 50; password.IsRequired = true; password.Type = stringType; password.Secret = true; principal.AddField( password ); } if( !principal.HasField( "email" ) ) { EntityField mail = new EntityField( "email" ); mail.MaxSize = 200; mail.IsPreview = true; mail.IsRequired = true; mail.Type = stringType; //mail.Regex.Add( mail.Unique = true; principal.AddField( mail ); } if( !principal.HasField( "ip" ) ) { EntityField ip = new EntityField( "ip" ); ip.MaxSize = 15; ip.Type = stringType; ip.IsPreview = true; //ip.Regex.Add( principal.AddField( ip ); } if( !principal.HasField( "registDate" ) ) { EntityField registDate = new EntityField( "registDate" ); registDate.IsRequired = true; registDate.Type = dateTimeType; //principal.Regex.Add( principal.AddField( registDate ); } if( !principal.HasField( "lastLogin" ) ) { EntityField lastLogin = new EntityField( "lastLogin" ); lastLogin.IsRequired = true; lastLogin.Type = dateTimeType; //principal.Regex.Add( principal.AddField( lastLogin ); } if( !principal.HasField( "approved" ) ) { EntityField approved = new EntityField( "approved" ); approved.IsRequired = true; approved.Type = boolType; approved.Default = false; principal.AddField( approved ); } if( !principal.HasField( "isOnline" ) ) { EntityField isOnline = new EntityField( "isOnline" ); isOnline.Type = boolType; isOnline.Default = false; principal.AddField( isOnline ); } if( !principal.HasField( "locked" ) ) { EntityField locked = new EntityField( "locked" ); locked.Type = boolType; locked.Default = false; principal.AddField( locked ); } if( !principal.HasField( "locale" ) ) { EntityField locale = new EntityField( "locale" ); locale.Type = stringType; locale.IsRequired = true; locale.MaxSize = 6; principal.AddField( locale ); } if( !principal.HasField( "roles" ) ) { EntityField role = new EntityField( "roles" ); role.Type = CreateRoleEntity( project, principal ); role.Mult = Multiplicity.ManyToMany; role.Lazy = false; principal.AddField( role ); } if( !principal.HasField("confirmationCode") ) { EntityField confirmationCode = new EntityField("confirmationCode"); confirmationCode.Type = stringType; confirmationCode.IsRequired = true; principal.AddField(confirmationCode); } EntityInterface iPrincipal = new EntityInterface(); iPrincipal.Name = "System.Security.Principal.IPrincipal"; principal.Interfaces.Add( iPrincipal ); }
public void test_inequality_new_classes_same_id() { var item = new EntityClass() { Id = Guid.NewGuid() }; var item2 = new EntityClass() { Id = item.Id }; Assert.IsTrue(item == item2); }
private void SetInitCombo(ref EntityClass entity) { // コンボボックス初期選択 List<string> lst; lst = MeiNameList.GetListMei(MeiNameList.geNameKbn.DISPLAY_DIVISION_ID); entity._display_division_nm = lst[1]; entity._display_division_id = MeiNameList.GetID(MeiNameList.geNameKbn.BREAKDOWN_ID, lst[1]); }
private void InitDetail(ref EntityClass entity) { //entity._condition_divition_id = 1; SetInitCombo(ref entity); }
// F3ボタン(行挿入) クリック public override void btnF3_Click(object sender, RoutedEventArgs e) { try { // 明細初期設定 EntityClass entity = new EntityClass(); InitDetail(ref entity); int _selectedIndex = 0; int _displayIndex = 0; if (_entity == null) { _entity = new ObservableCollection<EntityClass>(); _entity.Add(entity); SetDetailRecNo(); } else { if (this.dg.ConfirmEditEnd() == false) return; _selectedIndex = dg.SelectedIndex; _displayIndex = this.dg.CurrentColumn.DisplayIndex; _entity.Insert(_selectedIndex + 1, entity); SetDetailRecNo(); dg.SelectedIndex = _selectedIndex; this.dg.CurrentColumn = this.dg.Columns[_displayIndex]; //// 一旦行挿入を入れてコピー //ObservableCollection<EntityClass> _copy_entity = new ObservableCollection<EntityClass>(); //for (int i = 0; i <= _entity.Count - 1; i++) //{ // if (dg.SelectedIndex == i) // { // _copy_entity.Add(entity); // } // _copy_entity.Add(_entity[i]); //} //// コピーを戻す //_entity = null; //_entity = _copy_entity; //this.dg.ItemsSource = _entity; //ExDataGridUtilty.zCommitEdit(this.dg); //ExBackgroundWorker.DoWork_SelectDgCell(this.dg, _selectedIndex, _displayIndex); } } catch (Exception ex) { ExMessageBox.Show(CLASS_NM + ".btnF3_Click : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } }