private void saveItemData(NpcData data) { if (hasPropertyChanges) { Console.WriteLine("Saving NPC Properties"); data.ID = txtID.Text; data.Name = StringUtils.setString(txtName.Text); lstProperties.SaveItem(data); hasPropertyChanges = false; selected_item.UpdateDisplayValues(); npcMgr.HasChanges = true; // npcMgr.addAvailableType(data.Type); npcMgr.addAvailableClan(data.GetValue(NpcData.VAR_CLAN, null)); npcMgr.addAvailableIgnoreClan(data.GetValue(NpcData.VAR_IGNORE_CLAN_LIST, null)); npcMgr.addAvailableRace(data.GetValue(NpcData.VAR_RACE, null)); npcMgr.addAvailableBaseAttackType(data.GetValue(NpcData.VAR_BASE_ATTACK_TYPE, null)); } // if (hasDropChanges) { Console.WriteLine("Saving NPC Drop Groups"); saveDropGroups(data); hasDropChanges = false; npcMgr.HasChanges = true; } // if (hasSpoilChanges) { Console.WriteLine("Saving NPC Spoils"); NpcSpoilGroup spoil_items = lstSpoilItems.Write(); data.SetSpoilItems(spoil_items); hasSpoilChanges = false; npcMgr.HasChanges = true; } // scriptControl.Save(); }
public void Load(NpcData data) { Clear(); if (data == null) { HasChanges = false; return; } // string var_ai = data.GetValue(NpcData.VAR_NPC_AI, null); ScriptProperty prop = ScriptProperty.FromString(var_ai); string name = prop.ScriptName; // if (!string.IsNullOrEmpty(name)) { ScriptPageControl page, first_page; first_page = page = addTab(name); // string current, super; bool has_super; current = name; do { super = page.GetSuper(); has_super = (!string.IsNullOrEmpty(super) && super != current && super != "(null)"); if (has_super) { page = addTab(super); } }while (page != null && has_super); // is_loading = true; current_page = first_page; lstScript.SelectedItem = first_page.Script; setPage(first_page.Script); is_loading = false; } // HasChanges = false; }
public void LoadItem(NpcData item) { src_npc = item; // isLoading = true; lstTypes.Text = item.Type; txtLevel.Text = item.GetValue(NpcData.VAR_LEVEL, "0"); txtAI.Text = getAI(item.GetValue(NpcData.VAR_NPC_AI, null)); txtAcquireExpRate.Text = item.GetValue(NpcData.VAR_ACQUIRE_EXP_RATE, null); txtAcquireSp.Text = item.GetValue(NpcData.VAR_ACQUIRE_SP, null); chkUnsowing.IsChecked = item.GetValue(NpcData.VAR_UNSOWING, false); lstClan.Text = item.GetValue(NpcData.VAR_CLAN, null); lstIgnoreClanList.Text = item.GetValue(NpcData.VAR_IGNORE_CLAN_LIST, null); txtClanHelpRange.Text = item.GetValue(NpcData.VAR_CLAN_HELP_RANGE, null); txtSlotChest.Text = StringUtils.getString(item.GetValue(NpcData.VAR_SLOT_CHEST, null)); txtSlotRHand.Text = StringUtils.getString(item.GetValue(NpcData.VAR_SLOT_RHAND, null)); txtSlotLHand.Text = StringUtils.getString(item.GetValue(NpcData.VAR_SLOT_LHAND, null)); txtShieldDefenseRate.Text = item.GetValue(NpcData.VAR_SHIELD_DEFENSE_RATE, null); txtShieldDefense.Text = item.GetValue(NpcData.VAR_SHIELD_DEFENSE, null); lstRace.Text = item.GetValue(NpcData.VAR_RACE, null); lstSex.SelectedIndex = getSex(item.GetValue(NpcData.VAR_SEX, null)); chkUndying.IsChecked = item.GetValue(NpcData.VAR_UNDYING, false); chkCanBeAttacked.IsChecked = item.GetValue(NpcData.VAR_CAN_BE_ATTACKED, false); txtCorpseTime.Text = item.GetValue(NpcData.VAR_CORPSE_TIME, null); chkNoSleepMode.IsChecked = item.GetValue(NpcData.VAR_NO_SLEEP_MODE, false); txtAgroRange.Text = item.GetValue(NpcData.VAR_AGRO_RANGE, null); txtGroundHigh.Text = getFirstTri(item.GetValue(NpcData.VAR_GROUND_HIGH, null)); txtGroundLow.Text = getFirstTri(item.GetValue(NpcData.VAR_GROUND_LOW, null)); txtExp.Text = item.GetValue(NpcData.VAR_EXP, null); txtOrgHp.Text = item.GetValue(NpcData.VAR_ORG_HP, null); txtOrgHpRegen.Text = item.GetValue(NpcData.VAR_ORG_HP_REGEN, null); txtOrgMp.Text = item.GetValue(NpcData.VAR_ORG_MP, null); txtOrgMpRegen.Text = item.GetValue(NpcData.VAR_ORG_MP_REGEN, null); txtCollisionRadius.Text = getDual(item.GetValue(NpcData.VAR_COLLISION_RADIUS, null)); txtCollisionHeight.Text = getDual(item.GetValue(NpcData.VAR_COLLISION_HEIGHT, null)); txtStr.Text = item.GetValue(NpcData.VAR_STR, null); txtInt.Text = item.GetValue(NpcData.VAR_INT, null); txtDex.Text = item.GetValue(NpcData.VAR_DEX, null); txtWit.Text = item.GetValue(NpcData.VAR_WIT, null); txtCon.Text = item.GetValue(NpcData.VAR_CON, null); txtMen.Text = item.GetValue(NpcData.VAR_MEN, null); lstBaseAttackType.Text = item.GetValue(NpcData.VAR_BASE_ATTACK_TYPE, null); txtBaseAttackRange.Text = item.GetValue(NpcData.VAR_BASE_ATTACK_RANGE, null); // string[] baseDamageRange = getDamageRange(item.GetValue(NpcData.VAR_BASE_DAMAGE_RANGE, null)); txtBaseDamageRange_angle.Text = (baseDamageRange.Length > 2 ? baseDamageRange[2] : null); txtBaseDamageRange_distance.Text = (baseDamageRange.Length > 3 ? baseDamageRange[3] : null); // txtBaseRandDam.Text = item.GetValue(NpcData.VAR_BASE_RAND_DAM, null); txtBasePhysicalAttack.Text = item.GetValue(NpcData.VAR_BASE_PHYSICAL_ATTACK, null); txtBaseCritical.Text = item.GetValue(NpcData.VAR_BASE_CRITICAL, null); txtPhysicalHitModify.Text = item.GetValue(NpcData.VAR_PHYSICAL_HIT_MODIFY, null); txtBaseAttackSpeed.Text = item.GetValue(NpcData.VAR_BASE_ATTACK_SPEED, null); txtBaseReuseDelay.Text = item.GetValue(NpcData.VAR_BASE_REUSE_DELAY, null); txtBaseMagicAttack.Text = item.GetValue(NpcData.VAR_BASE_MAGIC_ATTACK, null); txtBaseDefend.Text = item.GetValue(NpcData.VAR_BASE_DEFEND, null); txtBaseMagicDefend.Text = item.GetValue(NpcData.VAR_BASE_MAGIC_DEFEND, null); txtPhysicalAvoidModify.Text = item.GetValue(NpcData.VAR_PHYSICAL_AVOID_MODIFY, null); txtSoulshotCount.Text = item.GetValue(NpcData.VAR_SOULSHOT_COUNT, null); txtSpiritShotCount.Text = item.GetValue(NpcData.VAR_SPIRITSHOT_COUNT, null); txtHitTimeFactor.Text = item.GetValue(NpcData.VAR_HIT_TIME_FACTOR, null); txtSafeHeight.Text = item.GetValue(NpcData.VAR_SAFE_HEIGHT, null); isLoading = false; hasChanges = false; }