Exemple #1
0
        public void InteractWith(Character character, NpcActionTypeEnum actionType)
        {
            if (character.Busy)
            {
                return;
            }

            if (actionType == NpcActionTypeEnum.Talk && CinematicProvider.Instance.IsNpcHandled(character, SpawnRecord.Id))
            {
                var npcPoint = new Maps.MapPoint((short)this.CellId);
                character.SetDirection(character.Point.OrientationTo(npcPoint, true));
                character.RandomTalkEmote();
                CinematicProvider.Instance.TalkToNpc(character, SpawnRecord.Id);
                return;
            }

            NpcActionRecord action = GetAction(actionType);

            if (action != null)
            {
                NpcActionProvider.Handle(character, this, action);
            }
            else if (character.Client.Account.Role > ServerRoleEnum.Player)
            {
                character.Reply("No (" + actionType + ") action linked to this npc...(" + SpawnRecord.Id + ")");
            }
        }
Exemple #2
0
 public void InteractWith(NpcActionTypeEnum actionType, Character dialoguer)
 {
     if (this.CanInteractWith(actionType, dialoguer))
     {
         var infoDialog = new PrismInfoDialog(dialoguer, this);
         infoDialog.Open();
     }
 }
Exemple #3
0
 public void InteractWith(NpcActionTypeEnum actionType, Character dialoguer)
 {
     if (this.CanInteractWith(actionType, dialoguer))
     {
         TaxCollectorInfoDialog taxCollectorInfoDialog = new TaxCollectorInfoDialog(dialoguer, this);
         taxCollectorInfoDialog.Open();
     }
 }
Exemple #4
0
 public void InteractWith(NpcActionTypeEnum actionType, Character dialoguer)
 {
     if (this.CanInteractWith(actionType, dialoguer))
     {
         NpcAction npcAction = this.Actions.First((NpcAction entry) => entry.ActionType == actionType && entry.CanExecute(this, dialoguer));
         npcAction.Execute(this, dialoguer);
         this.OnInteracted(actionType, npcAction, dialoguer);
     }
 }
Exemple #5
0
        private void OnInteracted(NpcActionTypeEnum actionType, NpcAction action, Character character)
        {
            Action <Npc, NpcActionTypeEnum, NpcAction, Character> interacted = this.Interacted;

            if (interacted != null)
            {
                interacted(this, actionType, action, character);
            }
        }
Exemple #6
0
        private void OnInteracted(NpcActionTypeEnum actionType, NpcAction action, Character character)
        {
            character.OnInteractingWith(this, actionType, action);
            var handler = Interacted;

            if (handler != null)
            {
                handler(this, actionType, action, character);
            }
        }
Exemple #7
0
        public void InteractWith(NpcActionTypeEnum actionType, Character dialoguer)
        {
            if (!CanInteractWith(actionType, dialoguer))
            {
                return;
            }

            var dialog = new TaxCollectorInfoDialog(dialoguer, this);

            dialog.Open();
        }
Exemple #8
0
        public void InteractWith(NpcActionTypeEnum actionType, Character dialoguer)
        {
            if (!CanInteractWith(actionType, dialoguer))
            {
                return;
            }

            var action = Actions.Where(entry => entry.ActionType.Contains(actionType) && entry.CanExecute(this, dialoguer)).OrderBy(x => x.Priority).First();

            action.Execute(this, dialoguer);
            OnInteracted(actionType, action, dialoguer);
        }
Exemple #9
0
        public bool CanInteractWith(NpcActionTypeEnum action, Character dialoguer)
        {
            if (dialoguer.Map != Position.Map || dialoguer.IsFighting() || dialoguer.IsInRequest() || dialoguer.IsGhost())
            {
                return(false);
            }

            if (dialoguer.IsBusy())
            {
                dialoguer.Dialog.Close();
            }

            return(Actions.Count > 0 && Actions.Any(entry => entry.ActionType.Contains(action) && entry.CanExecute(this, dialoguer)));
        }
Exemple #10
0
 public NpcActionAttribute(NpcActionTypeEnum actionType)
 {
     this.ActionType = actionType;
 }
Exemple #11
0
 public static List <NpcActionRecord> GetActionByType(NpcActionTypeEnum type)
 {
     return(NpcsActions.FindAll(x => x.ActionIdEnum == type));
 }
Exemple #12
0
 public bool CanInteractWith(NpcActionTypeEnum action, Character dialoguer)
 {
     return(!(dialoguer.Map != this.Position.Map) && this.Actions.Count > 0 && this.Actions.Any((NpcAction entry) => entry.ActionType == action && entry.CanExecute(this, dialoguer)));
 }
Exemple #13
0
 public bool CanInteractWith(NpcActionTypeEnum action, Character dialoguer)
 {
     throw new NotImplementedException();
 }
Exemple #14
0
 private void CharacterOnInteractingWith(Character character, Npc npc, NpcActionTypeEnum actionType, NpcAction action)
 {
 }
Exemple #15
0
 private NpcActionRecord GetAction(NpcActionTypeEnum actionType)
 {
     return(ActionsRecord.Find(x => x.ActionIdEnum == actionType));
 }
Exemple #16
0
 public bool CanInteractWith(NpcActionTypeEnum action, Character dialoguer)
 {
     return(this.CanBeSee(dialoguer) && action == NpcActionTypeEnum.ACTION_TALK);
 }
 public static NpcActionsRecord GetNpcAction(int npcid, NpcActionTypeEnum type)
 {
     return(NpcsActions.Find(x => x.NpcId == npcid && x.ActionType == type));
 }