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; } } }