/// <summary> /// /// </summary> /// <param name="fighter"></param> /// <param name="weapon"></param> public void CheckWeapon(AbstractFighter fighter, ItemTemplateDAO weapon) { foreach (var challenge in m_challenges) { challenge.CheckWeapon(fighter, weapon); } }
/// <summary> /// /// </summary> private void AddToSell(ItemTemplateDAO item) { listViewSellList.Items.Add(new ListViewItem(new string[] { item.Id.ToString(), item.Name }) { Tag = item }); }
/// <summary> /// /// </summary> private void AddToSell(ItemTemplateDAO item) { listViewSellList.Items.Add(new ListViewItem(new string[] { item.Id.ToString(), item.Name }) { Tag = item }); }
/// <summary> /// /// </summary> private void CheckCraftable() { m_craftItem = (m_caseItems.Count > 0) ? Skill.Craftables.Find(entry => entry.MatchCraft(m_templateQuantity)) : null; }
/// <summary> /// /// </summary> private void CheckCraftable() { m_craftItem = (m_caseItems.Count > 0) ? Skill.Craftables.Find(entry => entry.MatchCraft(m_templateQuantity)) : null; }
/// <summary> /// /// </summary> /// <param name="fighter"></param> /// <param name="weaponTemplate"></param> public virtual void CheckWeapon(AbstractFighter fighter, ItemTemplateDAO weaponTemplate) { }
/// <summary> /// /// </summary> /// <param name="fighter"></param> /// <param name="weapon"></param> public void CheckWeapon(AbstractFighter fighter, ItemTemplateDAO weapon) { foreach (var challenge in m_challenges) challenge.CheckWeapon(fighter, weapon); }
/// <summary> /// /// </summary> /// <param name="fighter"></param> /// <param name="weaponTemplate"></param> public virtual void CheckWeapon(AbstractFighter fighter, ItemTemplateDAO weaponTemplate) { }
/// <summary> /// /// </summary> /// <param name="item"></param> /// <param name="slot"></param> /// <param name="quantity"></param> public void MoveItem(ItemDAO item, ItemSlotEnum slot, int quantity = 1) { if (slot == item.Slot) { return; } if (quantity > item.Quantity || quantity < 1) { quantity = item.Quantity; } if (item.IsEquiped && !ItemDAO.IsEquipedSlot(slot)) { if (item.IsBoostEquiped) { Entity.Statistics.UnMerge(StatsType.TYPE_BOOST, item.Statistics); } else { Entity.Statistics.UnMerge(StatsType.TYPE_ITEM, item.Statistics); } if (item.Slot == ItemSlotEnum.SLOT_WEAPON) { Entity.Dispatch(WorldMessage.JOB_TOOL_EQUIPPED()); } item.SlotId = (int)slot; m_entityLookRefresh = true; bool merged = AddItem(MoveQuantity(item, 1)); RemoveSet(item); // send new stats if (Entity.Type == EntityTypeEnum.TYPE_CHARACTER) { Entity.MovementHandler.Dispatch(WorldMessage.ENTITY_OBJECT_ACTUALIZE(Entity)); CachedBuffer = true; if (!merged) { Dispatch(WorldMessage.OBJECT_MOVE_SUCCESS(item.Id, item.SlotId)); } Dispatch(WorldMessage.ACCOUNT_STATS((CharacterEntity)Entity)); if (item.Template.SetId != 0) { Dispatch(WorldMessage.ITEM_SET(item.Template.Set, Items.Where(entry => entry.Template.SetId == item.Template.SetId && entry.IsEquiped))); } CachedBuffer = false; } return; } else if (!item.IsEquiped && ItemDAO.IsEquipedSlot(slot)) { if (!ItemTemplateDAO.CanPlaceInSlot((ItemTypeEnum)item.Template.Type, slot)) { base.Dispatch(WorldMessage.OBJECT_MOVE_ERROR()); return; } // level required if (Entity.Level < item.Template.Level) { base.Dispatch(WorldMessage.OBJECT_MOVE_ERROR_REQUIRED_LEVEL()); return; } // Already equiped template if (HasTemplateEquiped(item.TemplateId)) { base.Dispatch(WorldMessage.OBJECT_MOVE_ERROR_ALREADY_EQUIPED()); return; } if (Entity.Type == EntityTypeEnum.TYPE_CHARACTER) { if (!item.SatisfyConditions((CharacterEntity)Entity)) { base.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_CONDITIONS_UNSATISFIED)); return; } } var equipedItem = Items.Find(entry => entry.SlotId == (int)slot && entry.Id != item.Id); // already equiped in slot ? remove it if (equipedItem != null) { MoveItem(equipedItem, ItemSlotEnum.SLOT_INVENTORY); } m_entityLookRefresh = true; var newItem = MoveQuantity(item, 1); newItem.SlotId = (int)slot; AddItem(newItem, false); AddSet(newItem); if (item.IsBoostEquiped) { Entity.Statistics.Merge(StatsType.TYPE_BOOST, item.Statistics); } else { Entity.Statistics.Merge(StatsType.TYPE_ITEM, item.Statistics); } // send new stats if (Entity.Type == EntityTypeEnum.TYPE_CHARACTER) { Entity.MovementHandler.Dispatch(WorldMessage.ENTITY_OBJECT_ACTUALIZE(Entity)); base.CachedBuffer = true; Entity.MovementHandler.Dispatch(WorldMessage.ENTITY_OBJECT_ACTUALIZE(Entity)); base.Dispatch(WorldMessage.ACCOUNT_STATS((CharacterEntity)Entity)); if (item.Template.SetId != 0) { base.Dispatch(WorldMessage.ITEM_SET(item.Template.Set, Items.Where(entry => entry.Template.SetId == item.Template.SetId && entry.IsEquiped))); } if (newItem.Slot == ItemSlotEnum.SLOT_WEAPON) { var character = (CharacterEntity)Entity; character.CharacterJobs.ToolEquipped(item.TemplateId); } base.CachedBuffer = false; } } else { var newItem = MoveQuantity(item, quantity); newItem.SlotId = (int)slot; if (!AddItem(newItem, false)) { base.Dispatch(WorldMessage.OBJECT_MOVE_SUCCESS(item.Id, item.SlotId)); } } }