public static void NPCTalkPartnerStartResponse(WorldClient client, bool success, ulong id, string partnerName) { var packet = new MabiPacket(Op.NPCTalkPartnerR, client.Character.Id); packet.PutByte(success); if (success) { packet.PutLong(id); packet.PutString(client.Character.Name + "'s " + partnerName); packet.PutString(client.Character.Name + "'s " + partnerName); client.Send(packet); } client.Send(packet); }
/// <summary> /// Sends Age Increase Packet /// </summary> /// <param name="client"></param> /// <param name="creature"></param> /// <param name="age"></param> public static void AgeIncrease(WorldClient client, MabiPC player, ushort age) { var p = new MabiPacket(Op.AgeIncrease, player.Id); p.PutShort(age); client.Send(p); }
public static void NPCTalkKeywordResponse(WorldClient client, bool success, string keyword) { var packet = new MabiPacket(Op.NPCTalkKeywordR, client.Character.Id); packet.PutByte(success); if (success) packet.PutString(keyword); client.Send(packet); }
public static void ConfirmMailRecipentResponse(WorldClient client, bool success, ulong recipientId) { var packet = new MabiPacket(Op.ConfirmMailRecipentR, client.Character.Id); packet.PutByte(success); if (success) packet.PutLong(recipientId); client.Send(packet); }
public static void NPCTalkStartResponse(WorldClient client, bool success, ulong npcId) { var packet = new MabiPacket(Op.NPCTalkStartR, client.Character.Id); packet.PutByte(success); if (success) packet.PutLong(npcId); client.Send(packet); }
public static void GetMailsResponse(WorldClient client, IEnumerable<MabiMail> mails) { var p = new MabiPacket(Op.GetMailsR, client.Character.Id); foreach (var mail in mails) p.Add(mail); p.PutLong(0); client.Send(p); }
public static void RecallMailResponse(WorldClient client, bool success, ulong mailId) { var packet = new MabiPacket(Op.RecallMailR, client.Character.Id); packet.PutByte(success); if (success) { packet.PutByte(success); packet.PutLong(mailId); } client.Send(packet); }
protected void OpenMailbox(WorldClient client) { client.Send(new MabiPacket(Op.OpenMail, client.Character.Id).PutLong(this.NPC.Id)); }
private CommandResult Command_set_inventory(WorldClient client, MabiCreature creature, string[] args, string msg) { if (args.Length < 2) return CommandResult.WrongParameter; if (args[1] != "/c") { Send.ServerMessage(client, creature, Localization.Get("gm.si_param"), args[1]); // Unknown paramter '{0}'. return CommandResult.Fail; } byte pocket = 2; if (args.Length >= 3) { var match = Regex.Match(args[2], "/p:(?<id>[0-9]+)"); if (!match.Success) { Send.ServerMessage(client, creature, Localization.Get("gm.si_param_pocket"), args[2]); // Unknown paramter '{0}', please specify a pocket. return CommandResult.Fail; } if (!byte.TryParse(match.Groups["id"].Value, out pocket) || pocket > (byte)Pocket.Max - 1) { Send.ServerMessage(client, creature, Localization.Get("gm.si_pocket")); // Invalid pocket. return CommandResult.Fail; } } var toRemove = new List<MabiItem>(); foreach (var item in creature.Items) { if (item.Info.Pocket == pocket) toRemove.Add(item); } foreach (var item in toRemove) { creature.Items.Remove(item); client.Send(PacketCreator.ItemRemove(creature, item)); } Send.ServerMessage(client, creature, Localization.Get("gm.si_cleared"), ((Pocket)pocket), toRemove.Count); // Cleared pocket '{0}'. (Deleted items: {1}) return CommandResult.Okay; }
/// <summary> /// Sends view equipment to client. Response is negative if items is null. /// </summary> /// <param name="client"></param> /// <param name="targetId"></param> /// <param name="items"></param> public static void ViewEquipmentResponse(WorldClient client, ulong targetId, IEnumerable<MabiItem> items) { var packet = new MabiPacket(Op.ViewEquipmentR, client.Character.Id); if (items != null) { packet.PutByte(true); packet.PutLong(targetId); packet.PutInt((ushort)items.Count()); foreach (var item in items) packet.AddItemInfo(item, ItemPacketType.Private); } else { packet.PutByte(false); } client.Send(packet); }
/// <summary> /// Enables item shop button. /// </summary> /// <param name="client"></param> public static void ItemShopInfo(WorldClient client) { var packet = new MabiPacket(Op.ItemShopInfo, client.Character.Id); packet.PutByte(0); client.Send(); }
public static void NewKeyword(WorldClient client, ushort keywordId) { var pp = new MabiPacket(Op.NewKeyword, client.Character.Id); pp.PutShort(keywordId); client.Send(pp); }
public static void GMCPInvisibilityResponse(WorldClient client, bool success) { var packet = new MabiPacket(Op.GMCPInvisibilityR, client.Character.Id); packet.PutByte(success); client.Send(packet); }
/// <summary> /// Opens GM Control Panel. /// </summary> /// <param name="client"></param> public static void GMCPOpen(WorldClient client) { var packet = new MabiPacket(Op.GMCPOpen, client.Character.Id); client.Send(packet); }
public static void CutsceneStart(WorldClient client, MabiCutscene cutscene) { var p = new MabiPacket(Op.CutsceneStart, Id.World); p.PutLongs(client.Character.Id, cutscene.Leader.Id); p.PutString(cutscene.Name); p.PutSInt(cutscene.Actors.Count); foreach (var a in cutscene.Actors) { p.PutString(a.Item1); p.PutShort((ushort)a.Item2.Length); p.PutBin(a.Item2); } p.PutInt(1); p.PutLong(client.Character.Id); client.Send(p); }
/// <summary> /// Sends enter region permission, which kinda makes the client warp. /// </summary> /// <param name="client"></param> /// <param name="creature"></param> /// <param name="permission"></param> public static void EnterRegionPermission(WorldClient client, MabiCreature creature, bool permission = true) { var pos = creature.GetPosition(); var p = new MabiPacket(Op.EnterRegionPermission, Id.World); p.PutLong(creature.Id); p.PutByte(permission); if (permission) { p.PutInt(creature.Region); p.PutInt(pos.X); p.PutInt(pos.Y); } client.Send(p); }
public virtual void EndDialog(WorldClient client, string msg) { client.Send(new MabiPacket(Op.NPCTalkSelectEnd, client.Character.Id)); this.Close(client, msg); }
public void OpenMapWindow(WorldClient c, MabiPC cr, MabiProp pr) { var gate = _gates.Values.FirstOrDefault(a => a.Region == cr.Region); if (gate == null || gate.Prop.State == "closed") return; if(!cr.Keywords.Contains(gate.KeywordId)) cr.Keywords.Add(gate.KeywordId); var mygates = _gates.Values.Where(a => cr.Keywords.Contains(a.KeywordId) || _freeRoaming || cr.Keywords.Contains(10142)); var p = new MabiPacket(Op.MoonGateMap, cr.Id); p.PutInt(2); p.PutString(gate.Ident); p.PutByte((byte)mygates.Count()); foreach (var g in mygates) { p.PutShort(g.KeywordId); p.PutByte(1); p.PutInts(g.Region, g.X, g.Y); } c.Send(p); }
protected void SendScript(WorldClient client, string xml) { var p = new MabiPacket(Op.NPCTalk, client.Character.Id); p.PutString(xml); p.PutBin(new byte[] { 0 }); client.Send(p); }
private static void GuildstoneTouch(WorldClient client, MabiCreature creature, MabiProp p) { var match = Regex.Match(p.ExtraData, "guildid=\"([0-9]+)\""); if (!match.Success) return; var guildId = ulong.Parse(match.Groups[1].Value); var guild = WorldDb.Instance.GetGuild(guildId); if (guild != null) { if (creature.Guild != null) { if (guild.Id == creature.Guild.Id && creature.GuildMember.MemberRank < GuildMemberRank.Applied) { client.Send(new MabiPacket(Op.OpenGuildPanel, creature.Id).PutLong(guild.Id).PutBytes(0, 0, 0)); } else { client.Send( new MabiPacket(Op.GuildInfo, creature.Id) .PutLong(guild.Id) .PutString(guild.Name) .PutString(guild.LeaderName) .PutInt(CountAcceptedMembers(guild.Id)) .PutString(guild.IntroMessage) ); } } else { client.Send( new MabiPacket(Op.GuildInfoNoGuild, creature.Id) .PutLong(guild.Id) .PutStrings(guild.Name) .PutStrings(guild.LeaderName) .PutInt(CountAcceptedMembers(guild.Id)) .PutString(guild.IntroMessage) ); } } }
public static void SendMailResponse(WorldClient client, MabiMail mail) { var packet = new MabiPacket(Op.SendMailR, client.Character.Id); if (mail != null) { packet.PutByte(true); packet.Add(mail); } else { packet.PutByte(false); } client.Send(packet); }
public static void OpenNPCShop(WorldClient client, MabiShop shop) { var packet = new MabiPacket(Op.OpenNPCShop, client.Character.Id); packet.PutString("shopname"); packet.PutByte(0); packet.PutByte(0); packet.PutInt(0); packet.PutByte((byte)shop.Tabs.Count); for (var i = 0; i < shop.Tabs.Count; ++i) { packet.PutString("[{0}]{1}", i, shop.Tabs[i].Name); // [160200] ? { packet.PutByte(0); } packet.PutShort((ushort)shop.Tabs[i].Items.Count); foreach (var item in shop.Tabs[i].Items) packet.AddItemInfo(item, ItemPacketType.Private); } client.Send(packet); }
public static void NPCTalkSelectEnd(WorldClient client) { var packet = new MabiPacket(Op.NPCTalkSelectEnd, client.Character.Id); client.Send(packet); }
public virtual void Close(WorldClient client, string message = "<end/>") { var p = new MabiPacket(Op.NPCTalkEndR, client.Character.Id); p.PutByte(1); p.PutLong(client.NPCSession.Target.Id); p.PutString(message); client.Send(p); }
/// <summary> /// Sends unlock for creature. /// </summary> /// <param name="client"></param> /// <param name="creature"></param> /// <param name="lockType"></param> public static void CharacterUnlock(WorldClient client, MabiCreature creature, uint lockType = 0xEFFFFFFE) { var p = new MabiPacket(Op.CharacterUnlock, creature.Id); p.PutInt(lockType); client.Send(p); }
private CommandResult Command_gmcp(WorldClient client, MabiCreature creature, string[] args, string msg) { if (client.Account.Authority < WorldConf.MinimumGMCP) { Send.ServerMessage(client, creature, Localization.Get("gm.gmcp_auth")); // You're not authorized to use the GMCP. return CommandResult.Fail; } client.Send(new MabiPacket(Op.GMCPOpen, creature.Id)); //Send.ServerMessage(client, creature, Localization.Get("gm.gmcp_disabled"))); // The GMCP is currently disabled or not available. return CommandResult.Okay; }
private void HandleMoonGateUse(WorldClient client, MabiPacket packet) { var character = client.GetCreatureOrNull(packet.Id) as MabiPC; if(character == null) goto L_Fail; var source = packet.GetString(); var target = packet.GetString(); // Check gates MoonGate sGate, tGate; _gates.TryGetValue(source, out sGate); _gates.TryGetValue(target, out tGate); if (sGate == null || tGate == null || sGate.Prop.State == "closed") goto L_Fail; // Check range to source if (character.Region != sGate.Region || !WorldManager.InRange(character, sGate.X, sGate.Y, 1000)) goto L_Fail; // Check if char has target if (!character.Keywords.Contains(tGate.KeywordId) && !_freeRoaming && !character.Keywords.Contains(10142)) goto L_Fail; client.Warp(tGate.Region, tGate.X, tGate.Y); client.Send(new MabiPacket(Op.MoonGateUseR, client.Character.Id).PutByte(true)); return; L_Fail: client.Send(new MabiPacket(Op.MoonGateUseR, client.Character.Id).PutByte(false)); }