public NpcDialog Finish() { _packets.Add(LegacyPackets.NpcFinish()); return(this); }
private static void Process(YiObj target, YiObj invoker, cq_action cqaction, SquigglyContext db) { if (cqaction == null || cqaction.id == 0) { return; } invoker.CurrentAction = cqaction; var type = (Cq_ActionId)cqaction.type; //Output.WriteLine($"Mob Action -> Type: {type}:{(int) type} Data: {cqaction.data} Param: {cqaction.param.Trim()}"); switch (type) { default: { Output.WriteLine($"Unknown Cq_ActionId -> {cqaction}", ConsoleColor.Blue); break; } case Cq_ActionId.ACTION_MENUTEXT: { if (invoker is Player player) { player.Send(LegacyPackets.NpcSay(cqaction.param.Trim().Replace("~", " "))); if (cqaction.id_next == 0) { player.Send(LegacyPackets.NpcFinish()); } else { Process(target, invoker, db.cq_action.Find(cqaction.id_next), db); } } break; } case Cq_ActionId.ACTION_MENULINK: { if (invoker is Player player) { var option = cqaction.param.Trim().Split(' ')[0]; var sControl = cqaction.param.Split(' ', StringSplitOptions.RemoveEmptyEntries); var control = int.Parse(sControl[1]); player.NpcTasks.Add((byte)player.NpcTasks.Count, (int)control); player.Send(LegacyPackets.NpcLink(option.Replace("~", " "), (byte)(player.NpcTasks.Count - 1))); if (cqaction.id_next == 0) { player.Send(LegacyPackets.NpcFinish()); } else { Process(target, invoker, db.cq_action.Find(cqaction.id_next), db); } } break; } case Cq_ActionId.ACTION_MENUPIC: { if (invoker is Player player) { var faceId = byte.Parse(cqaction.param.Trim().Split(' ')[2]); player.Send(LegacyPackets.NpcFace(faceId)); if (cqaction.id_next == 0) { player.Send(LegacyPackets.NpcFinish()); } else { Process(target, invoker, db.cq_action.Find(cqaction.id_next), db); } } break; } case Cq_ActionId.ACTION_MENUCREATE: { if (invoker is Player player) { player.Send(LegacyPackets.NpcFinish()); } break; } case Cq_ActionId.ACTION_USER_SEX: { if (cqaction.id_nextfail == 0 && cqaction.id_next == 0) { return; } //If male next_id else nextid_fail break; } case Cq_ActionId.ACTION_ITEM_CHECK: { ACTION_ITEM_CHECK(target, invoker, cqaction, db); break; } case Cq_ActionId.ACTION_MST_DROPITEM: { ACTION_MST_DROPITEM(target, invoker, cqaction, db); break; } case Cq_ActionId.ACTION_RAND: { ACTION_RAND(target, invoker, cqaction, db); break; } case Cq_ActionId.ACTION_USER_ATTR: { ACTION_USER_ATTR(target, invoker, cqaction, db); break; } case Cq_ActionId.ACTION_RANDACTION: { ACTION_RANDACTION(target, invoker, cqaction, db); break; } case Cq_ActionId.ACTION_USER_TALK: { invoker.GetMessage("SYSTEM", invoker.Name.Trim(), cqaction.param.Trim().Replace("~", ""), (MsgTextType)cqaction.data); break; } case Cq_ActionId.ACTION_USER_HAIR: { ACTION_USER_HAIR(target, invoker, cqaction, db); break; } case Cq_ActionId.ACTION_USER_MEDIAPLAY: { ACTION_USER_MEDIAPLAY(target, invoker, cqaction, db); break; } case Cq_ActionId.ACTION_USER_EFFECT: { ACTION_USER_EFFECT(target, invoker, cqaction, db); break; } case Cq_ActionId.ACTION_USER_CHGMAP: { ACTION_USER_CHGMAP(target, invoker, cqaction, db); break; } case Cq_ActionId.ACTION_ITEM_LEAVESPACE: ACTION_ITEM_LEAVESPACE(target, invoker, cqaction, db); break; case Cq_ActionId.ACTION_ITEM_ADD: ACTION_ITEM_ADD(target, invoker, cqaction, db); break; case Cq_ActionId.ACTION_ITEM_MULTICHK: ACTION_ITEM_MULTICHK(target, invoker, cqaction, db); break; case Cq_ActionId.ACTION_ITEM_MULTIDEL: ACTION_ITEM_MULTIDEL(target, invoker, cqaction, db); break; case Cq_ActionId.ACTION_CHKTIME: ACTION_CHKTIME(target, invoker, cqaction, db); break; case Cq_ActionId.ACTION_USER_MAGIC: ACTION_USER_MAGIC(target, invoker, cqaction, db); break; } }