Exemplo n.º 1
0
Arquivo: Map.cs Projeto: Pircs/Yi
        public void Leave(YiObj obj)
        {
            Entities.TryRemove(obj.UniqueId);

            switch (obj)
            {
            case Npc npc:
                //RemoveNpc(obj);
                break;

            case DynamicNpc npc:
                //RemoveNpc(obj);
                break;

            case Monster monster:
                RemoveMob(obj);
                break;

            case FloorItem item:
                RemoveItem(obj);
                break;
            }

            ScreenSystem.Send(obj, MsgAction.Create(obj, 0, MsgActionType.EntityRemove));
            ScreenSystem.ClearFor(obj);
        }
Exemplo n.º 2
0
            public void UpdateLeaderPosition(Player player)
            {
                if (player.UniqueId != Leader.UniqueId)
                {
                    return;
                }

                foreach (var member in Teams[player.UniqueId].Members)
                {
                    (member.Value as Player)?.Send(MsgAction.Create(Environment.TickCount, Leader.UniqueId, Leader.UniqueId, Leader.Location.X, Leader.Location.Y, 0, MsgActionType.QueryTeamLeader));
                }
            }
Exemplo n.º 3
0
 public static bool Execute(Player player, int npcId, byte control, string input)
 {
     try
     {
         switch (control)
         {
         case 0:
             player.Send(MsgAction.Create(player, 1, MsgActionType.Dialog));
             break;
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 4
0
 public Monster()
 {
     Brain      = new BasicBrain(this);
     DespawnJob = new Job(3000, () => ScreenSystem.Send(this, MsgAction.Create(this, 0, MsgActionType.EntityRemove)));
 }
Exemplo n.º 5
0
 public Monster()
 {
     Brain      = new BasicBrain(this);
     DespawnJob = new Job(3000, () => ScreenSystem.Send(this, MsgAction.Create(this, 0, MsgActionType.EntityRemove)));
     RespawnJob = new Job(Collections.Spawns[SpawnId].RespawnDelay * 1000 * 30, Respawn);
 }
Exemplo n.º 6
0
        public static bool Execute(Player player, int npcId, byte control, string input)
        {
            //Debugger.Break();
            try
            {
                var storages = StorageSystem.GetStorageListForId(player, player.CurrentNpcId).ToList();
                switch (control)
                {
                case 0:
                {
                    if (string.IsNullOrEmpty(input))
                    {
                        goto case 2;
                    }

                    uint storageId;
                    if (uint.TryParse(input, out storageId))
                    {
                        var found = storages.FirstOrDefault(storage => storage.StorageId == storageId);
                        if (found != null)
                        {
                            player.CurrentStorageId = found.StorageId;
                            player.Send(MsgAction.Create(player, 4, MsgActionType.Dialog));
                            YiScheduler.Instance.Do(SchedulerPriority.MediumLow, () => StorageSystem.ShowStock(player));
                        }
                    }
                    break;
                }

                case 1:
                {
                    uint storageId;
                    if (uint.TryParse(input, out storageId))
                    {
                        var found = storages.FirstOrDefault(storage => storage.StorageId == storageId);
                        if (found != null)
                        {
                            player.CurrentStorageId = found.StorageId;
                            player.Send(MsgAction.Create(player, 4, MsgActionType.Dialog));
                            YiScheduler.Instance.Do(SchedulerPriority.MediumLow, () => StorageSystem.ShowStock(player));
                            break;
                        }
                    }
                    DisplayStorages(player, storages);
                    break;
                }

                case 2:
                {
                    if (storages.Count < 2)
                    {
                        StorageSystem.NewStorage(player, player.CurrentNpcId);
                        player.ForceSend(MsgAction.Create(player, 4, MsgActionType.Dialog), 24);
                        //player.Send(MsgStorage.Create(player.CurrentStorageId, MsgStorageAction.List));
                        YiScheduler.Instance.Do(SchedulerPriority.MediumLow, () => StorageSystem.ShowStock(player));
                        break;
                    }
                    DisplayStorages(player, storages);
                    break;
                }
                }
            }
            catch
            {
                return(false);
            }
            return(true);
        }