public override int GetHashCode() { int hash = 1; if (MonsterId != 0UL) { hash ^= MonsterId.GetHashCode(); } if (MonsterBaseId != 0) { hash ^= MonsterBaseId.GetHashCode(); } if (SyncMoveId != 0) { hash ^= SyncMoveId.GetHashCode(); } hash ^= hpValues_.GetHashCode(); hash ^= atkValues_.GetHashCode(); hash ^= defValues_.GetHashCode(); hash ^= spaValues_.GetHashCode(); hash ^= spdValues_.GetHashCode(); hash ^= speValues_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static void RegisterAsNpc(this GameObject o) { EnemyData d = o.GetData() as EnemyData; MonsterId mId = (MonsterId)Enum.Parse(typeof(MonsterId), "" + d.monsterId); GameSystem.Instance.RegisterNewNpc(d, mId); }
public SiegeMobData(MonsterId id, int level, float delay, int wave, int direction = 0) { this.id = id; this.level = level; this.timeDelay = delay; this.wave = wave; this.direction = direction; }
public void SetMonsterStat(MonsterTb monsterData) { id = monsterData.id; maxHp = monsterData.hp; moveSpeed = monsterData.moveSpeed; name = monsterData.name; targetType = monsterData.targetType; monsterPoint = monsterData.monsterPoint; hp = maxHp; }
public MonsterTemplate GetType(MonsterId type) { if (type == MonsterId.CustomMonster) { throw new ArgumentException("nelze zavolat gettype na MonsterId.CustomMonster, pouzit metodu s parametrem pro string"); } MonsterTemplate tObject; types.TryGetValue(type, out tObject); return(tObject); }
public MonsterTemplate GetType(string typeName) { if (Enum.IsDefined(typeof(MonsterId), typeName)) { MonsterId id = (MonsterId)Enum.Parse(typeof(MonsterId), typeName); return(GetType(id)); } else { return(GetCustomTemplate(typeName)); } }
/// <summary> /// Registruje NPC do hry /// </summary> public Npc RegisterNewNpc(EnemyData data, MonsterId id) { Npc npc; npc = new Npc(id.ToString(), data, MonsterTemplateTable.Instance.GetType(id)); data.SetOwner(npc); npc.Init(); npc.isMinion = false; npc.InitTemplate(); return(npc); }
private Npc SpawnNpc(MonsterId id, Vector3 position) { GameObject go = Resources.Load("Prefabs/entity/" + id.ToString() + "/" + id.ToString()) as GameObject; if (go == null) { throw new NullReferenceException("Prefabs/entity/" + id.ToString() + "/" + id); } GameObject result = Object.Instantiate(go, position, Quaternion.identity) as GameObject; EnemyData data = result.GetComponent <EnemyData>(); return(RegisterNewNpc(data, id)); }
public override int GetHashCode() { int hash = 1; if (MonsterId != 0) { hash ^= MonsterId.GetHashCode(); } if (Reason != 0) { hash ^= Reason.GetHashCode(); } return(hash); }
public static MonsterGroup Serdes(int _, MonsterGroup m, AssetMapping mapping, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } m ??= new MonsterGroup(); for (int i = 0; i < m.Grid.Length; i++) { m.Grid[i] = MonsterId.SerdesU8( i.ToString(CultureInfo.InvariantCulture), m.Grid[i], mapping, s); s.UInt8(null, 0); } return(m); }
public override int GetHashCode() { int hash = 1; if (MonsterId != 0) { hash ^= MonsterId.GetHashCode(); } if (myPlayer_ != null) { hash ^= MyPlayer.GetHashCode(); } if (monster_ != null) { hash ^= Monster.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (MonsterId != 0) { hash ^= MonsterId.GetHashCode(); } if (Reason != 0) { hash ^= Reason.GetHashCode(); } if (playerData_ != null) { hash ^= PlayerData.GetHashCode(); } hash ^= items_.GetHashCode(); return(hash); }
public Monster SpawnMonster(MonsterId id, Vector3 position, bool isMinion, int level, int team = 0) { GameObject go = Resources.Load("Prefabs/entity/" + id.ToString() + "/" + id.ToString()) as GameObject; if (go == null) { throw new NullReferenceException("Prefabs/entity/" + id.ToString() + "/" + id); } GameObject result = Object.Instantiate(go, position, Quaternion.identity) as GameObject; EnemyData data = result.GetComponent <EnemyData>(); Monster m = RegisterNewMonster(data, id, isMinion, level); if (team > 0) { m.Team = team; } return(m); }
public override int GetHashCode() { int hash = 1; if (PlayerId != 0UL) { hash ^= PlayerId.GetHashCode(); } if (MonsterId != 0) { hash ^= MonsterId.GetHashCode(); } if (X != 0) { hash ^= X.GetHashCode(); } if (Y != 0) { hash ^= Y.GetHashCode(); } return(hash); }
/*public Monster RegisterNewMonster(EnemyData data, String name, int id, int level, Dictionary<string, string> parameters) * { * Monster monster; * * MonsterId mId = (MonsterId) Enum.Parse(typeof (MonsterId), ""+id); * * MonsterTemplate mt = MonsterTemplateTable.Instance.GetType(mId); * * if (mt is BossTemplate) * { * monster = new Boss(name, data, (BossTemplate) mt); * } * else * { * monster = new Monster(name, data, mt); * } * * data.SetOwner(monster); * monster.SetLevel(level); * * monster.Init(); * monster.InitTemplate(); * * return monster; * }*/ //TODO make use of parameters dictionary to pass level, etc /// <summary> /// Registruje monstrum do hry podle MonsterID /// </summary> private Monster RegisterNewMonster(EnemyData data, MonsterId id, bool isMinion, int level, Dictionary <string, string> parameters = null) { Monster monster; MonsterTemplate mt = MonsterTemplateTable.Instance.GetType(id); if (mt is BossTemplate) { monster = new Boss(id.ToString(), data, (BossTemplate)mt); } else { monster = new Monster(id.ToString(), data, mt); } data.SetOwner(monster); monster.SetLevel(level); monster.Init(); monster.isMinion = isMinion; monster.InitTemplate(); return(monster); }
public Boss SpawnBoss(MonsterId id, Vector3 position, int level) { GameObject go = Resources.Load("Prefabs/entity/" + id.ToString() + "/" + id.ToString()) as GameObject; if (go == null) { throw new NullReferenceException("Prefabs/entity/" + id.ToString() + "/" + id); } GameObject result = Object.Instantiate(go, position, Quaternion.identity) as GameObject; EnemyData data = result.GetComponent <EnemyData>(); Monster m = RegisterNewMonster(data, id, false, level); if (m is Boss) { return((Boss)m); } else { Debug.LogError("tried to spawn boss - but it was a monster ! fix it in data"); throw new NullReferenceException(); } }
public GroupTemplate Add(MonsterId id, int count) { MembersToSpawn.Add(id, count); return(this); }
public static MonsterTb GetMonsterTb(this MonsterId id) { return(Table <MonsterId, MonsterTb> .GetTb(id)); }
public override int GetHashCode() { int hash = 1; if (TrainerId != 0UL) { hash ^= TrainerId.GetHashCode(); } if (U2 != 0) { hash ^= U2.GetHashCode(); } if (ScoutMethod != 0) { hash ^= ScoutMethod.GetHashCode(); } if (TrainerBaseId != 0) { hash ^= TrainerBaseId.GetHashCode(); } if (Type != 0) { hash ^= Type.GetHashCode(); } if (Rarity != 0) { hash ^= Rarity.GetHashCode(); } if (Role != 0) { hash ^= Role.GetHashCode(); } if (MonsterId != 0UL) { hash ^= MonsterId.GetHashCode(); } if (Move1Id != 0) { hash ^= Move1Id.GetHashCode(); } if (Move2Id != 0) { hash ^= Move2Id.GetHashCode(); } if (Move3Id != 0) { hash ^= Move3Id.GetHashCode(); } if (Move4Id != 0) { hash ^= Move4Id.GetHashCode(); } if (WeakType != 0) { hash ^= WeakType.GetHashCode(); } if (U14 != 0) { hash ^= U14.GetHashCode(); } if (U15 != 0) { hash ^= U15.GetHashCode(); } if (Passive1Id != 0) { hash ^= Passive1Id.GetHashCode(); } if (Passive2Id != 0) { hash ^= Passive2Id.GetHashCode(); } if (Passive3Id != 0) { hash ^= Passive3Id.GetHashCode(); } if (Passive4Id != 0) { hash ^= Passive4Id.GetHashCode(); } if (Passive5Id != 0) { hash ^= Passive5Id.GetHashCode(); } if (U21.Length != 0) { hash ^= U21.GetHashCode(); } if (ScheduleId.Length != 0) { hash ^= ScheduleId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (TrainerId != 0L) { hash ^= TrainerId.GetHashCode(); } if (TrainerKind != 0) { hash ^= TrainerKind.GetHashCode(); } if (ScoutMethod != 0) { hash ^= ScoutMethod.GetHashCode(); } if (Exclusivity != 0L) { hash ^= Exclusivity.GetHashCode(); } if (TrainerBaseId != 0) { hash ^= TrainerBaseId.GetHashCode(); } if (Type != 0) { hash ^= Type.GetHashCode(); } if (Rarity != 0) { hash ^= Rarity.GetHashCode(); } if (Role != 0) { hash ^= Role.GetHashCode(); } if (MonsterId != 0UL) { hash ^= MonsterId.GetHashCode(); } if (Move1Id != 0) { hash ^= Move1Id.GetHashCode(); } if (Move2Id != 0) { hash ^= Move2Id.GetHashCode(); } if (Move3Id != 0) { hash ^= Move3Id.GetHashCode(); } if (Move4Id != 0) { hash ^= Move4Id.GetHashCode(); } if (Weakness != 0) { hash ^= Weakness.GetHashCode(); } if (StoryQuest != 0UL) { hash ^= StoryQuest.GetHashCode(); } if (U16 != 0) { hash ^= U16.GetHashCode(); } if (Passive1Id != 0) { hash ^= Passive1Id.GetHashCode(); } if (Passive2Id != 0) { hash ^= Passive2Id.GetHashCode(); } if (Passive3Id != 0) { hash ^= Passive3Id.GetHashCode(); } if (Passive4Id != 0) { hash ^= Passive4Id.GetHashCode(); } if (TeamSkill1Id != 0) { hash ^= TeamSkill1Id.GetHashCode(); } if (TeamSkill2Id != 0) { hash ^= TeamSkill2Id.GetHashCode(); } if (TeamSkill3Id != 0) { hash ^= TeamSkill3Id.GetHashCode(); } if (TeamSkill4Id != 0) { hash ^= TeamSkill4Id.GetHashCode(); } if (TeamSkill5Id != 0) { hash ^= TeamSkill5Id.GetHashCode(); } if (U26 != 0) { hash ^= U26.GetHashCode(); } if (U27 != 0) { hash ^= U27.GetHashCode(); } if (Number != 0) { hash ^= Number.GetHashCode(); } if (ScheduleId.Length != 0) { hash ^= ScheduleId.GetHashCode(); } if (ExScheduleId.Length != 0) { hash ^= ExScheduleId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override string[] SaveArgs() { return(new[] { Amount.ToString(), MonsterId.ToString() }); }
public override int GetHashCode() { int hash = 1; if (MonsterId != 0UL) { hash ^= MonsterId.GetHashCode(); } if (Form != 0) { hash ^= Form.GetHashCode(); } if (ActorId.Length != 0) { hash ^= ActorId.GetHashCode(); } if (AtkScale != 0) { hash ^= AtkScale.GetHashCode(); } if (DefScale != 0) { hash ^= DefScale.GetHashCode(); } if (SpaScale != 0) { hash ^= SpaScale.GetHashCode(); } if (SpdScale != 0) { hash ^= SpdScale.GetHashCode(); } if (SpeScale != 0) { hash ^= SpeScale.GetHashCode(); } if (Move1Id != 0L) { hash ^= Move1Id.GetHashCode(); } if (Move2Id != 0L) { hash ^= Move2Id.GetHashCode(); } if (Move3Id != 0L) { hash ^= Move3Id.GetHashCode(); } if (Move4Id != 0L) { hash ^= Move4Id.GetHashCode(); } if (Move5Id != 0L) { hash ^= Move5Id.GetHashCode(); } if (Move6Id != 0L) { hash ^= Move6Id.GetHashCode(); } if (Passive1Id != 0) { hash ^= Passive1Id.GetHashCode(); } if (Passive2Id != 0) { hash ^= Passive2Id.GetHashCode(); } if (Passive3Id != 0) { hash ^= Passive3Id.GetHashCode(); } if (U18 != 0) { hash ^= U18.GetHashCode(); } if (U19 != 0) { hash ^= U19.GetHashCode(); } if (U20 != 0) { hash ^= U20.GetHashCode(); } if (U21 != 0) { hash ^= U21.GetHashCode(); } if (U22 != 0) { hash ^= U22.GetHashCode(); } if (U23 != 0) { hash ^= U23.GetHashCode(); } if (U24 != 0) { hash ^= U24.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public Npc SpawnNpc(string npcTypeName, Vector3 position) { MonsterId id = (MonsterId)Enum.Parse(typeof(MonsterId), npcTypeName); return(SpawnNpc(id, position)); }
private void LoadXml(string fileName) { XmlDocument doc = new XmlDocument(); doc.Load(fileName); int nextId = 0; CustomMonsterTemplate newTemplate; foreach (XmlNode monsterNode in doc.DocumentElement.ChildNodes) { if (!monsterNode.Name.Equals("monster")) { continue; } newTemplate = new CustomMonsterTemplate(); if (monsterNode.Attributes != null) { foreach (XmlAttribute attr in monsterNode.Attributes) { if (attr.Name == "name") { newTemplate.TemplateName = attr.Value; } } } foreach (XmlNode mainParam in monsterNode.ChildNodes) { switch (mainParam.Name) { case "name": newTemplate.TemplateName = mainParam.InnerText; break; case "visibleName": newTemplate.Name = mainParam.InnerText; break; case "target_rotation_speed": newTemplate.TargetRotationSpeed = int.Parse(mainParam.InnerText); break; case "check_visibility": newTemplate.CheckVisibility = bool.Parse(mainParam.InnerText); break; case "attack_closest": newTemplate.AttackClosest = bool.Parse(mainParam.InnerText); break; case "sprite": newTemplate.Sprite = mainParam.InnerText; break; case "animation": newTemplate.Animation = mainParam.InnerText; break; case "size": newTemplate.SpriteSize = float.Parse(mainParam.InnerText); break; case "mass": newTemplate.Mass = float.Parse(mainParam.InnerText); break; case "template": MonsterId id = (MonsterId)Enum.Parse(typeof(MonsterId), mainParam.InnerText); MonsterTemplate oldTemplate = GetType(id); newTemplate.SetDefaultTemplate(oldTemplate); break; case "stats": foreach (XmlNode statNode in mainParam.ChildNodes) { switch (statNode.Name) { case "MaxHp": newTemplate.MaxHp = Int32.Parse(statNode.InnerText); break; case "MaxHp_scale": newTemplate.HpLevelScale = Int32.Parse(statNode.InnerText); break; case "MaxSpeed": newTemplate.MaxSpeed = Int32.Parse(statNode.InnerText); break; case "RotationSpeed": newTemplate.RotationSpeed = Int32.Parse(statNode.InnerText); break; case "IsAggressive": newTemplate.IsAggressive = statNode.InnerText.ToLower() == "true"; break; case "AggressionRange": newTemplate.AggressionRange = Int32.Parse(statNode.InnerText); break; case "RambleAround": newTemplate.RambleAround = statNode.InnerText.ToLower() == "true"; break; case "RambleAroundMaxDist": newTemplate.RambleAroundMaxDist = Int32.Parse(statNode.InnerText); break; case "AlertsAllies": newTemplate.AlertsAllies = statNode.InnerText.ToLower() == "true"; break; case "XpReward": newTemplate.XpReward = Int32.Parse(statNode.InnerText); break; } } break; case "spawn_on_die": foreach (XmlNode mNode in mainParam.ChildNodes) { string name = mNode.Name; newTemplate.AddOnSpawnOnDie(name); } break; case "attached_cells": foreach (XmlNode mNode in mainParam.ChildNodes) { string name = mNode.Name; newTemplate.AddAttachedCell(name); } break; case "ai": string aiType = "Blank"; if (mainParam.Attributes != null) { foreach (XmlAttribute attr in mainParam.Attributes) { if (attr.Name == "type") { aiType = attr.Value; } } } if (aiType == null) { continue; } newTemplate.AiType = aiType + "MonsterAI"; foreach (XmlNode statNode in mainParam.ChildNodes) { if (statNode.Name == "set") { string idString = null; string module = null; string param = null; string value = null; if (statNode.Attributes != null) { foreach (XmlAttribute attrib in statNode.Attributes) { switch (attrib.Name) { case "id_module": idString = attrib.Value; break; case "module": module = attrib.Value; break; case "param": param = attrib.Value; break; case "value": value = attrib.Value; break; } } } if ((module != null || idString != null) && param != null && value != null) { int idVal = -1; if (idString != null) { idVal = Int32.Parse(idString); } newTemplate.AddAiParam(idVal, module, param, value); } } else if (statNode.Name == "add") { string idString = null; string module = null; string param = null; string value = null; string priority = "low"; if (statNode.Attributes != null) { foreach (XmlAttribute attrib in statNode.Attributes) { switch (attrib.Name) { case "id_module": idString = attrib.Value; break; case "priority": // "low", "high" priority = attrib.Value; break; case "module": module = attrib.Value; break; case "param": param = attrib.Value; break; case "value": value = attrib.Value; break; } } } if (module != null) { int idNumber = -1; if (idString != null) { idNumber = Int32.Parse(idString); } newTemplate.AddAIModule(idNumber, module, priority, param, value); } } } break; case "add_skills": foreach (XmlNode skillNode in mainParam.ChildNodes) { string skillName = skillNode.Name; SkillId skillId = (SkillId)Enum.Parse(typeof(SkillId), skillName); newTemplate.NewSkills.Add(skillId); foreach (XmlNode skillParamNode in skillNode.ChildNodes) { if (skillParamNode.Name == "add_effect") { string effectName = null; Dictionary <string, string> parameters = new Dictionary <string, string>(); foreach (XmlAttribute attr in skillParamNode.Attributes) { if (attr.Name == "name") { effectName = attr.Value; } else { parameters.Add(attr.Name, attr.Value); } } newTemplate.AddAdditionalSkillEffects(skillId, effectName, parameters); } else if (skillParamNode.Name == "remove_effects") { newTemplate.DisableSkillEffects(skillId); } else { string paramName = skillParamNode.Name; string val = skillParamNode.InnerText; newTemplate.AddSkillModifyInfo(skillId, paramName, val); } } } break; case "modify_skills": foreach (XmlNode skillNode in mainParam.ChildNodes) { string skillName = skillNode.Name; SkillId skillId = (SkillId)Enum.Parse(typeof(SkillId), skillName); foreach (XmlNode skillParamNode in skillNode.ChildNodes) { if (skillParamNode.Name == "add_effect") { string effectName = null; Dictionary <string, string> parameters = new Dictionary <string, string>(); foreach (XmlAttribute attr in skillParamNode.Attributes) { if (attr.Name == "name") { effectName = attr.Value; } else { parameters.Add(attr.Name, attr.Value); } } newTemplate.AddAdditionalSkillEffects(skillId, effectName, parameters); } else if (skillParamNode.Name == "remove_effects") { newTemplate.DisableSkillEffects(skillId); } else { string paramName = skillParamNode.Name; string val = skillParamNode.InnerText; newTemplate.AddSkillModifyInfo(skillId, paramName, val); } } } break; case "remove_skills": foreach (XmlNode skillNode in mainParam.ChildNodes) { string skillName = skillNode.Name; SkillId skillId = (SkillId)Enum.Parse(typeof(SkillId), skillName); newTemplate.SkillsToRemove.Add(skillId); } break; case "add_autoattack": foreach (XmlNode skillNode in mainParam.ChildNodes) { string skillName = skillNode.Name; SkillId skillId = (SkillId)Enum.Parse(typeof(SkillId), skillName); newTemplate.NewAutoattack = skillId; foreach (XmlNode skillParamNode in skillNode.ChildNodes) { if (skillParamNode.Name == "add_effect") { string effectName = null; Dictionary <string, string> parameters = new Dictionary <string, string>(); foreach (XmlAttribute attr in skillParamNode.Attributes) { if (attr.Name == "name") { effectName = attr.Value; } else { parameters.Add(attr.Name, attr.Value); } } newTemplate.AddMeleeSkillEffects(skillId, effectName, parameters); } else if (skillParamNode.Name == "remove_effects") { newTemplate.DisableMeleeEffects(); } else { string paramName = skillParamNode.Name; string val = skillParamNode.InnerText; newTemplate.AddAutoattackModifyInfo(skillId, paramName, val); } } break; } break; case "remove_autoattack": newTemplate.NewAutoattack = SkillId.CustomRemove; break; } } newTemplate.InitCustomSkillsOnTemplate(); customTypes.Add(newTemplate); } }