private void SetNpcStatistics() { NpcData stats = CharacterDataProvider.Instance.GetNpcData(_transform); _threatReactionManager.DirectAttackThreatModifier = stats.DirectAttackThreatModifier; _threatReactionManager.PcHealingThreatModifier = stats.PcHealingThreatModifier; }
public NpcName(string file) { try { using (L2BinaryReader reader = new L2BinaryReader(File.OpenRead(file))) { Data = new NpcData[reader.ReadInt32()]; for (uint i = 0; i < Data.Length; i++) { NpcData data = new NpcData(); data.Id = reader.ReadUInt32(); data.Name = reader.ReadString(); data.Description = reader.ReadString(); data.RGB = reader.ReadBytes(3); data.Reserved = reader.ReadChar(); Data[i] = data; } reader.Validate(); } } catch (Exception) { Data = null; throw new InvalidDataException(ParsingFailed); } }
public void TalkClick(GameObject _talkObject) { talkObject = _talkObject; NpcData npcData = talkObject.GetComponent <NpcData>(); Talk(npcData.id); }
private void run_npc(NpcData data) { List <NpcDropGroup> items = data.GetDropGroups(); if (items == null) { return; } // NpcDropGroup item; decimal sum = 0m; bool has_changes = false; int c = items.Count; for (int i = 0; i < c; i++) { item = items[i]; if (item.GetSum(ref sum)) { item.BalanceRemainders(ref sum); has_changes = true; count++; } Total++; } // if (has_changes) { data.SetDropGroups(items); NpcMgr.HasChanges = true; } }
private void LoadNpc(NpcData npc) { this.textBoxNpcName.Text = npc.Name; this.labelNpcId.Text = npc.Guid.ToString(CultureInfo.InvariantCulture); this.comboBoxNpcType.SelectedIndex = npc.NpcType; this.comboBoxNpcAlignment.SelectedIndex = npc.Alignment; this.comboBoxSpecies.SelectedIndex = npc.Species; this.textBoxNpcGroupId.Text = npc.GroupId.ToString(CultureInfo.InvariantCulture); this.textBoxNpcLevel.Text = npc.Level.ToString(CultureInfo.InvariantCulture); this.textBoxLootGroupId.Text = npc.LootGroupId.ToString(CultureInfo.InvariantCulture); this.comboBoxNpcZone.SelectedIndex = Array.FindIndex(zones, id => id == npc.ZoneId); this.textBoxMaxHealth.Text = npc.MaxHealth.ToString(CultureInfo.InvariantCulture); this.textBoxMaxPower.Text = npc.MaxMana.ToString(CultureInfo.InvariantCulture); var pos = npc.Position; this.textBoxCoordX.Text = pos[0].ToString(CultureInfo.InvariantCulture); this.textBoxCoordY.Text = pos[1].ToString(CultureInfo.InvariantCulture); this.textBoxCoordZ.Text = pos[2].ToString(CultureInfo.InvariantCulture); this.txtOrientation.Text = npc.Orientation.ToString(CultureInfo.InvariantCulture); if (npc.Items != null) { this.possessiveItems = new HashSet <short>(npc.Items); } if (npc.StartQuests != null) { this.listBoxStartQuests.Items.AddRange(npc.StartQuests.Cast <object>().ToArray()); } if (npc.CompleteQuests != null) { this.listBoxCompleteQuests.Items.AddRange(npc.CompleteQuests.Cast <object>().ToArray()); } }
public Npc(int dataId) { m_NPCBaseData = DataManager.s_NpcDataManager.GetData(dataId); if (m_NPCBaseData == null) { Debug.LogError("NPCData is null: " + dataId); return; } }
public Tbl_ZoneMap_Record(XmlElement _element) { try { XmlNode node = (XmlElement)_element; SetValue( ref m_Index, node, "Index" ); SetValue( ref m_iAreaMapIdx, node, "AreaMapIdx" ); SetValue( ref m_strImgPath, node, "ImgPath" ); SetValue( ref m_iTooltipStrIdx, node, "TooltipStringIdx" ); // potal int iPotalListCount = 0; SetValue( ref iPotalListCount, node, "PotalCount" ); for( int i=0; i<iPotalListCount; ++i ) { string strElement = "Potal_"+(i+1); PotalData data = new PotalData(); data.position.x = float.Parse( _element[strElement].GetAttribute("x") ); data.position.y = float.Parse( _element[strElement].GetAttribute("y") ); data.position.z = float.Parse( _element[strElement].GetAttribute("z") ); data.iStrIdx = int.Parse( _element[strElement].GetAttribute("strIdx") ); data.uiPos.x = float.Parse( _element[strElement].GetAttribute("ui_x") ); data.uiPos.y = float.Parse( _element[strElement].GetAttribute("ui_y") ); m_PotalList.Add( data ); } // npc int iNpcListCount = 0; SetValue( ref iNpcListCount, node, "NpcCount" ); for( int i=0; i<iNpcListCount; ++i ) { string strElement = "Npc_"+(i+1); NpcData _data = new NpcData(); _data.iNpcId = int.Parse( _element[strElement].GetAttribute("id") ); _data.position.x = float.Parse( _element[strElement].GetAttribute("x") ); _data.position.y = float.Parse( _element[strElement].GetAttribute("y") ); _data.position.z = float.Parse( _element[strElement].GetAttribute("z") ); _data.iImgIdx = int.Parse( _element[strElement].GetAttribute("imgIdx") ); _data.iStrIdx = int.Parse( _element[strElement].GetAttribute("strIdx") ); _data.uiPos.x = float.Parse( _element[strElement].GetAttribute("ui_x") ); _data.uiPos.y = float.Parse( _element[strElement].GetAttribute("ui_y") ); m_NpcList.Add( _data ); } //waypoint int iWayPointList = 0; SetValue( ref iWayPointList, node, "WayPointList" ); for( int i=0; i<iWayPointList; ++i ) { string strElement = "WayPoint_"+(i+1); WayPointData data = new WayPointData(); data.position.x = float.Parse( _element[strElement].GetAttribute("x") ); data.position.y = float.Parse( _element[strElement].GetAttribute("y") ); data.position.z = float.Parse( _element[strElement].GetAttribute("z") ); data.iStrIdx = int.Parse( _element[strElement].GetAttribute("strIdx") ); data.uiPos.x = float.Parse( _element[strElement].GetAttribute("ui_x") ); data.uiPos.y = float.Parse( _element[strElement].GetAttribute("ui_y") ); m_WayPointList.Add( data ); } //local name int iLocalNameList = 0; SetValue( ref iLocalNameList, node, "LocalNameCount" ); for( int i=0; i<iLocalNameList; ++i ) { string strElement = "LocalName_"+(i+1); WayPointData data = new WayPointData(); data.position.x = float.Parse( _element[strElement].GetAttribute("x") ); data.position.y = float.Parse( _element[strElement].GetAttribute("y") ); data.position.z = float.Parse( _element[strElement].GetAttribute("z") ); data.iStrIdx = int.Parse( _element[strElement].GetAttribute("strIdx") ); data.uiPos.x = float.Parse( _element[strElement].GetAttribute("ui_x") ); data.uiPos.y = float.Parse( _element[strElement].GetAttribute("ui_y") ); m_LocalNameList.Add( data ); } } catch(System.Exception e) { Debug.LogError("[Tbl_ZoneMap_Record] 'constructor': |" + e.ToString() + "| error while parsing"); } }