/// <summary> /// Broadcasts EquipmentMoved in creature's range. /// </summary> /// <param name="creature"></param> /// <param name="from"></param> public static void EquipmentMoved(Creature creature, Pocket from) { var packet = new Packet(Op.EquipmentMoved, creature.EntityId); packet.PutByte((byte)from); packet.PutByte(1); creature.Region.Broadcast(packet, creature); }
/// <summary> /// Sends negative HomesteadEnterRequestR dummy to creature's client. /// </summary> /// <param name="creature"></param> public static void HomesteadEnterRequestR(Creature creature) { var packet = new Packet(Op.HomesteadEnterRequestR, creature.EntityId); packet.PutByte(false); packet.PutByte((byte)HomesteadEnterRequestResponse.FailedToEnter); creature.Client.Send(packet); }
/// <summary> /// Sends SkillCancel to creature's client. /// </summary> /// <param name="creature"></param> public static void SkillCancel(Creature creature) { var packet = new Packet(Op.SkillCancel, creature.EntityId); packet.PutByte(0); packet.PutByte(1); creature.Client.Send(packet); }
/// <summary> /// Broadcasts ChangeStance in range of creature. /// </summary> /// <param name="creature"></param> public static void ChangeStance(Creature creature) { var packet = new Packet(Op.ChangeStance, creature.EntityId); packet.PutByte(creature.IsInBattleStance); packet.PutByte(1); creature.Region.Broadcast(packet, creature); }
/// <summary> /// Sends HomesteadInfoRequestR to creature's client. /// </summary> /// <param name="creature"></param> public static void HomesteadInfoRequestR(Creature creature) { var packet = new Packet(Op.HomesteadInfoRequestR, creature.EntityId); packet.PutByte(0); packet.PutByte(0); packet.PutByte(1); creature.Client.Send(packet); }
/// <summary> /// Broadcasts PetAction in range of pet. /// </summary> /// <param name="pet"></param> /// <param name="action"></param> public static void PetActionEffect(Creature pet, PetAction action) { var packet = new Packet(Op.Effect, pet.EntityId); packet.PutInt(E.PetAction); packet.PutLong(pet.Master.EntityId); packet.PutByte((byte)action); packet.PutByte(0); pet.Region.Broadcast(packet, pet); }
/// <summary> /// Sends empty Weather packet to creature's client. /// </summary> public static void Weather(Creature creature, int regionId, int groupId) { var packet = new Packet(Op.Weather, MabiId.Broadcast); packet.PutByte(0); packet.PutInt(regionId); packet.PutByte(0); packet.PutInt(groupId); packet.PutByte(0); creature.Client.Send(packet); }
/// <summary> /// Sends (negative) LoginR to client. /// </summary> /// <param name="client"></param> /// <param name="result"></param> public static void LoginR_Fail(LoginClient client, LoginResult result) { var packet = new Packet(Op.LoginR, MabiId.Login); packet.PutByte((byte)result); if (result == LoginResult.SecondaryFail) { packet.PutInt(12); packet.PutByte(1); // TODO: Number of fail attempts } client.Send(packet); }
/// <summary> /// Sends Weather. /// </summary> private static void Weather(Action<Packet> sender, IWeatherProvider provider) { var packet = new Packet(Op.Weather, MabiId.Broadcast); packet.PutByte(0); packet.PutInt(provider.RegionId); if (provider is IWeatherProviderTable) { var table = (IWeatherProviderTable)provider; packet.PutByte(0); packet.PutInt(table.GroupId); packet.PutByte(2); packet.PutByte(1); packet.PutString("table"); packet.PutString(table.Name); packet.PutLong(0); packet.PutByte(0); } else if (provider is IWeatherProviderConstant) { var constant = (IWeatherProviderConstant)provider; // Packet structure is guessed, even though it works, // based on constant_smooth. packet.PutByte(2); packet.PutByte(0); packet.PutByte(1); packet.PutString("constant"); packet.PutFloat(constant.Weather); packet.PutLong(0); packet.PutByte(0); } else if (provider is IWeatherProviderConstantSmooth) { var constantSmooth = (IWeatherProviderConstantSmooth)provider; packet.PutByte(2); packet.PutByte(0); packet.PutByte(1); packet.PutString("constant_smooth"); packet.PutFloat(constantSmooth.Weather); packet.PutLong(DateTime.Now); // Start packet.PutLong(DateTime.MinValue); // End packet.PutFloat(constantSmooth.WeatherBefore); packet.PutFloat(constantSmooth.WeatherBefore); packet.PutLong(constantSmooth.TransitionTime); packet.PutByte(false); // bool? Is table appended? byte? Appended type? packet.PutLong(DateTime.MinValue); // End packet.PutInt(2); // Append a table packet here to go back to that after end packet.PutByte(0); } sender(packet); }
public static void System_Broadcast(string from, string format, params object[] args) { var packet = new Packet(Op.Chat, MabiId.Broadcast); packet.PutByte(0); packet.PutString("<{0}>", from); packet.PutString(format, args); packet.PutByte(true); packet.PutUInt(0xFFFF8080); packet.PutInt(0); packet.PutByte(0); ChannelServer.Instance.World.Broadcast(packet); }
/// <summary> /// Sends system message (special Chat) to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="from"></param> /// <param name="format"></param> /// <param name="args"></param> private static void SystemMessage(Creature creature, string from, string format, params object[] args) { var packet = new Packet(Op.Chat, creature.EntityId); packet.PutByte(0); packet.PutString(from); packet.PutString(format, args); packet.PutByte(true); packet.PutUInt(0xFFFF8080); packet.PutInt(0); packet.PutByte(0); creature.Client.Send(packet); }
/// <summary> /// Sends positive PersonalShopSetUpR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="shopProp"></param> public static void PersonalShopSetUpR(Creature creature, Prop shopProp) { var location = shopProp.GetLocation(); var packet = new Packet(Op.PersonalShopSetUpR, creature.EntityId); packet.PutByte(true); packet.PutLong(shopProp.EntityId); packet.PutByte(1); // no location if 0? packet.PutInt(location.RegionId); packet.PutInt(location.X); packet.PutInt(location.Y); creature.Client.Send(packet); }
/// <summary> /// Sends EnterDynamicRegion to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="warpFromRegionId"></param> /// <param name="warpToRegion"></param> public static void EnterDynamicRegion(Creature creature, int warpFromRegionId, Region warpToRegion, int x, int y) { var warpTo = warpToRegion as DynamicRegion; if (warpTo == null) throw new ArgumentException("EnterDynamicRegion requires a dynamic region."); var pos = creature.GetPosition(); var packet = new Packet(Op.EnterDynamicRegion, MabiId.Broadcast); packet.PutLong(creature.EntityId); packet.PutInt(warpFromRegionId); // creature's current region or 0? packet.PutInt(warpToRegion.Id); packet.PutString(warpToRegion.Name); // dynamic region name packet.PutUInt(0x80000000); // bitmask? (|1 = time difference?) packet.PutInt(warpTo.BaseId); packet.PutString(warpTo.BaseName); packet.PutInt(200); // 100|200 (100 changes the lighting?) packet.PutByte(0); // 1 = next is empty? packet.PutString("data/world/{0}/{1}", warpTo.BaseName, warpTo.Variation); packet.PutByte(0); //if (^ true) //{ // pp.PutByte(1); // pp.PutInt(3100); // some region id? //} packet.PutInt(x); // target x pos packet.PutInt(y); // target y pos creature.Client.Send(packet); }
/// <summary> /// Sends AcceptGiftR to client. /// </summary> /// <param name="client"></param> /// <param name="gift">Negative response if null</param> public static void AcceptGiftR(LoginClient client, Gift gift) { var packet = new Packet(Op.AcceptGiftR, MabiId.Login); packet.PutByte(gift != null); if (gift != null) { packet.PutByte(gift.IsCharacter); packet.PutInt(0); // ? packet.PutInt(0); // ? packet.PutInt(gift.Type); // ? } client.Send(packet); }
/// <summary> /// Sends TouchPropR to creature's client. /// </summary> /// <param name="creature"></param> public static void TouchPropR(Creature creature) { var packet = new Packet(Op.TouchPropR, creature.EntityId); packet.PutByte(true); creature.Client.Send(packet); }
/// <summary> /// Sends SosButtonRequestR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="enabled"></param> public static void SosButtonRequestR(Creature creature, bool enabled) { var packet = new Packet(Op.SosButtonRequestR, creature.EntityId); packet.PutByte(enabled); creature.Client.Send(packet); }
/// <summary> /// Sends RequestRebirthR to creature's client. /// </summary> /// <param name="vehicle"></param> public static void RequestRebirthR(Creature creature, bool success) { var packet = new Packet(Op.RequestRebirthR, MabiId.Login); packet.PutByte(success); creature.Client.Send(packet); }
/// <summary> /// Sends EnterRebirthR to creature's client. /// </summary> /// <param name="creature"></param> public static void EnterRebirthR(Creature creature) { var packet = new Packet(Op.EnterRebirthR, creature.EntityId); packet.PutByte(0); creature.Client.Send(packet); }
/// <summary> /// Sends PetUnmountR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="success"></param> public static void PetUnmountR(Creature creature, bool success) { var packet = new Packet(Op.PetUnmountR, creature.EntityId); packet.PutByte(success); creature.Client.Send(packet); }
/// <summary> /// Sends CompleteQuestR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="success"></param> public static void GiveUpQuestR(Creature creature, bool success) { var packet = new Packet(Op.GiveUpQuestR, creature.EntityId); packet.PutByte(success); creature.Client.Send(packet); }
/// <summary> /// Sends TelePetR to pet's client. /// </summary> /// <param name="pet"></param> /// <param name="success"></param> public static void TelePetR(Creature pet, bool success) { var packet = new Packet(Op.TelePetR, pet.EntityId); packet.PutByte(success); pet.Client.Send(packet); }
/// <summary> /// Sends PersonalShopSetPriceR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="success"></param> public static void PersonalShopSetPriceR(Creature creature, bool success) { var packet = new Packet(Op.PersonalShopSetPriceR, creature.EntityId); packet.PutByte(success); creature.Client.Send(packet); }
/// <summary> /// Broadcasts CancelMotion in creature's region. /// </summary> /// <param name="creature"></param> public static void CancelMotion(Creature creature) { var cancelPacket = new Packet(Op.CancelMotion, creature.EntityId); cancelPacket.PutByte(0); creature.Region.Broadcast(cancelPacket, creature); }
/// <summary> /// Sends negative SkillRankUp to creature's client. /// </summary> /// <param name="client"></param> /// <param name="creature"></param> public static void SkillAdvance_Fail(Creature creature) { var packet = new Packet(Op.SkillRankUp, creature.EntityId); packet.PutByte(false); creature.Client.Send(packet); }
/// <summary> /// Sends GmcpInvisibilityR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="success"></param> public static void GmcpInvisibilityR(Creature creature, bool success) { var packet = new Packet(Op.GmcpInvisibilityR, creature.EntityId); packet.PutByte(success); creature.Client.Send(packet); }
/// <summary> /// Sends ChannelDisconnectR to client. /// </summary> /// <param name="client"></param> public static void ChannelDisconnectR(ChannelClient client) { var packet = new Packet(Op.DisconnectRequestR, MabiId.Channel); packet.PutByte(0); client.Send(packet); }
/// <summary> /// Sends TradeCancelR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="success"></param> public static void TradeCancelR(Creature creature, bool success) { var packet = new Packet(Op.TradeCancelR, creature.EntityId); packet.PutByte(success); creature.Client.Send(packet); }
/// <summary> /// Sends BurnItemR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="success"></param> public static void BurnItemR(Creature creature, bool success) { var packet = new Packet(Op.BurnItemR, creature.EntityId); packet.PutByte(success); creature.Client.Send(packet); }
/// <summary> /// Sends DestroyExpiredItemsR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="success"></param> public static void DestroyExpiredItemsR(Creature creature, bool success) { var packet = new Packet(Op.DestroyExpiredItemsR, creature.EntityId); packet.PutByte(success); creature.Client.Send(packet); }
/// <summary> /// Sends ShopBuyItemR to creature's client. /// </summary> /// <param name="creature"></param> /// <param name="success"></param> public static void NpcShopBuyItemR(Creature creature, bool success) { var packet = new Packet(Op.NpcShopBuyItemR, creature.EntityId); if (!success) packet.PutByte(success); creature.Client.Send(packet); }