Exemple #1
0
        public static void HandleContinuation(Player player, byte[] packet)
        {
            Control = packet[10];
            if (player.NpcTasks == null || player.NpcTasks.Count == 0)
            {
                Process(player);
                return;
            }
            if (GameWorld.Find(player.CurrentNpcId, out Npc npc))
            {
                int task = 0;

                foreach (var kvp in player.NpcTasks)
                {
                    if (kvp.Key == Control)
                    {
                        task = kvp.Value;
                    }
                }
                player.NpcTasks.Clear();
                if (task == 0)
                {
                    return;
                }
                ConquerActionProcessor.ExecuteAction(npc, player, task);
            }
        }
Exemple #2
0
 public override void KilledFrom(YiObj attacker)
 {
     base.KilledFrom(attacker);
     AddStatusEffect(StatusEffect.Die | StatusEffect.Frozen | StatusEffect.Fade);
     YiScheduler.Instance.Do(3000, DespawnJob);
     RespawnJob = new Job(Collections.Spawns[SpawnId].RespawnDelay * 1000 * 30, Respawn);
     YiScheduler.Instance.Do(Collections.Spawns[SpawnId].RespawnDelay * 1000 * 15, RespawnJob);
     GameWorld.Maps[MapId].RemoveMob(this);
     MobDropSystem.Drop(attacker, this);
     ConquerActionProcessor.ExecuteAction(this, attacker);
 }
Exemple #3
0
        private static async void Process(Player player, int npcIdoverride = 0)
        {
            if (Control == 255 && player.Online)
            {
                player.CurrentNpcId = 0;
            }

            if (player.CurrentNpcId == 0)
            {
                return;
            }

            var id = player.CurrentNpcId;

            if (npcIdoverride != 0)
            {
                id = npcIdoverride;
            }

            switch (id)
            {
            case 1337:
            {
                switch (Control)
                {
                case 255:
                    player.CurrentNpcId = 1337;
                    using (var packet = new NpcDialog(10))
                    {
                        packet

                        .Text("Select Char")
                        .Link("Next", 1)
                        .Link("Select", 10)
                        .Link("New", 100)
                        .Finish();

                        player.Send(packet);
                    }
                    break;

                case 1:
                    var players = SelectorSystem.GetPlayersFor(player.AccountId).ToList();

                    var index = players.IndexOf(player);
                    if (index + 1 > players.Count - 1)
                    {
                        index = 0;
                    }
                    else
                    {
                        index++;
                    }

                    player = SelectorSystem.SwapCharacter(player, players[index]);
                    player.Send(LegacyPackets.CharacterInformation(player));
                    player.Send(MsgAction.MapShowPacket(player));
                    player.AddStatusEffect(StatusEffect.Frozen);
                    ScreenSystem.Create(player);
                    ScreenSystem.Update(player);
                    break;

                case 10:
                    player.RemoveStatusEffect(StatusEffect.Frozen);
                    ScreenSystem.Create(player);
                    player.AddSpawnProtection();
                    player.IncrementXp();

                    foreach (var kvp in player.Skills)
                    {
                        player.Send(MsgSkill.Create(kvp.Value));
                    }
                    foreach (var prof in player.Profs)
                    {
                        player.Send(MsgProf.Create(prof.Value));
                    }

                    EntityLogic.Recalculate(player);
                    player.CurrentHp = player.MaximumHp;
                    player.CurrentMp = player.MaximumMp;
                    GameWorld.Maps[player.MapId].Enter(player);

                    player.Send(MsgAction.Create(player, (int)player.PkMode, MsgActionType.ChangePkMode));
                    player.Send(MsgUpdate.Create(player, player.Stamina, MsgUpdateType.Stamina));
                    player.Send(MsgUpdate.Create(player, player.Class, MsgUpdateType.Class));
                    player.Online = true;

                    if (player.HasFlag(StatusEffect.SuperMan))
                    {
                        BuffSystem.Create(player);
                        BuffSystem.AddBuff(player, new Buff(player, SkillId.Superman, TimeSpan.FromSeconds(10)));
                    }
                    if (player.HasFlag(StatusEffect.Cyclone))
                    {
                        BuffSystem.Create(player);
                        BuffSystem.AddBuff(player, new Buff(player, SkillId.Cyclone, TimeSpan.FromSeconds(10)));
                    }

                    if (player.PkPoints > 1)
                    {
                        player.PkPJob = new Job(TimeSpan.FromSeconds(15), () => player.PkPoints--);
                        YiScheduler.Instance.Do(player.PkPJob);
                    }
                    ScreenSystem.Send(player, MsgAction.Create(player, player.UniqueId, MsgActionType.EntityRemove));
                    ScreenSystem.Send(player, MsgSpawn.Create(player));
                    break;

                case 100:
                    SelectorSystem.CreateNewCharacterFor(player.AccountId);
                    player.Disconnect();
                    break;
                }
                break;
            }

            default:
            {
                if (!await ScriptEngine.ActivateNpc(player, NpcId, (byte)Control, Input))
                {
                    if (GameWorld.Find(NpcId, out Npc npc) && Control == 0)
                    {
                        ConquerActionProcessor.ExecuteAction(npc, player, Control);
                    }
                    //Message.SendTo(player, $"[{player.CurrentNpcId}] Npc has no script.", MsgTextType.Talk);
                }
                break;
            }
            }
        }