public void OnAreaTrigger(WorldSession session, PCAreaTrigger packet) { areatrigger_teleport areaTrigger = Core.WorldDatabase.GetRepository<areatrigger_teleport>().SingleOrDefault(at => at.id == packet.TriggerID); if (areaTrigger != null) { session.SendMessage("[AreaTrigger] ID:" + packet.TriggerID + " " + areaTrigger.name); session.Player.Location.MapID = areaTrigger.target_map; session.Player.Location.X = areaTrigger.target_position_x; session.Player.Location.Y = areaTrigger.target_position_y; session.Player.Location.Z = areaTrigger.target_position_z; session.Player.Location.Orientation = areaTrigger.target_orientation; session.SendPacket(new PSTransferPending(areaTrigger.target_map)); session.SendPacket(new PSNewWorld(areaTrigger.target_map, areaTrigger.target_position_x, areaTrigger.target_position_y, areaTrigger.target_position_z, areaTrigger.target_orientation)); } else { session.SendMessage("[AreaTrigger] ID:" + packet.TriggerID); } }
public void OnWhisper(WorldSession session, PCMessageChat packet) { WorldSession remoteSession = Server.GetSessionByPlayerName(packet.To); if (remoteSession != null) { session.SendPacket(new PSMessageChat(ChatMessageType.CHAT_MSG_WHISPER_INFORM, ChatMessageLanguage.LANG_UNIVERSAL, remoteSession.Player.ObjectGUID.RawGUID, packet.Message)); remoteSession.SendPacket(new PSMessageChat(ChatMessageType.CHAT_MSG_WHISPER, ChatMessageLanguage.LANG_UNIVERSAL, session.Player.ObjectGUID.RawGUID, packet.Message)); } else { session.SendMessage("Player not found."); } }
private void OnListChannel(WorldSession session, PCChannel packet) { session.SendMessage("Users in channel " + packet.ChannelName + ":"); var channel = ChatChannels.SingleOrDefault(ch => ch.Name == packet.ChannelName); channel.Sessions.ForEach(s => session.SendMessage(s.Player.Name)); }
public void OnSetSelection(WorldSession session, PCSetSelection packet) { IUnitEntity target = null; WorldSession targetSession = Core.Server.Sessions.SingleOrDefault(s => s.Player.ObjectGUID.RawGUID == packet.GUID); if (targetSession != null) target = targetSession.Player; if (target == null) target = Core.GetComponent<EntityComponent>().CreatureEntities.SingleOrDefault(e => e.ObjectGUID.RawGUID == packet.GUID); if (target != null) { session.Player.Target = target; session.SendMessage("Target: " + target.Name); } else { session.SendMessage("Couldnt find target!"); session.Player.Target = null; } }
public void OnPing(WorldSession session, PCPing packet) { session.SendMessage("Ping: " + packet.Ping + " Latancy: " + packet.Latency); session.SendPacket(new PSPong(packet.Ping)); }
public static void Default(WorldSession session, string[] args) { if (args.Length == 1 && args[0].ToLower() == "list") { session.SendMessage("List"); } else if(args.Length == 2) { string attributeName = args[0].ToLower(); string attributeValue = args[1]; // If player isn't targeting. Target self IUnitEntity entity = session.Player.Target ?? session.Player; //TODO Fix horrible hack. UnitInfo info = entity.ObjectGUID.TypeID == TypeID.TYPEID_PLAYER ? (UnitInfo)((PlayerEntity)entity).Info : ((CreatureEntity)entity).Info; bool unknownAttribute = false; switch (attributeName) { case "faction": var val = uint.Parse(attributeValue); if (val == 0) session.SendMessage("FactionID: " + info.FactionTemplate); else { session.SendMessage("Old FactionID: " + info.FactionTemplate); info.FactionTemplate = val; session.SendMessage("New FactionID: " + info.FactionTemplate); } break; case "scale": info.Scale = float.Parse(attributeValue); break; case "health": info.Health = int.Parse(attributeValue); break; case "level": info.Level = int.Parse(attributeValue); break; case "xp": (info as PlayerInfo).XP = int.Parse(attributeValue); break; case "model": info.DisplayID = int.Parse(attributeValue); break; case "money": int moneyToAdd = int.Parse(attributeValue) < 0x7fffffff ? int.Parse(attributeValue) : 0x7fffffff; (info as PlayerInfo).Money += moneyToAdd; session.Player.Character.money += moneyToAdd; break; case "standstate": info.StandState = (byte)int.Parse(attributeValue); break; case "speed": info.WalkSpeed = float.Parse(attributeValue); session.SendPacket(new PSForceRunSpeedChange(entity.ObjectGUID, info.WalkSpeed)); break; default: unknownAttribute = true; break; } if (unknownAttribute) { session.SendMessage("Attribute '" + attributeName + "' was unknown"); } else { session.SendMessage("Applied " + attributeName + " = " + attributeValue + ""); } } }
public static void Lookup(WorldSession session, string[] args) { if(Teleports == null) AddTeleports(); if(args.Length == 0) session.SendMessage("Input a location name to list similar locations (e.g 'org')"); else { string locationName = args[0]; List<DistanceTeleportEntry> locations = FetchList(locationName); if (locations.Count > 10) locations = locations.GetRange(0, 10); session.SendMessage("-- Tele List --"); locations.ForEach(e => session.SendMessage(e.Distance + " - " + e.Entry.Name)); session.SendMessage(" "); } }