public void HandlePacket(GameClient client, GSPacketIn packet) { ushort keepId = packet.ReadShort(); ushort wallId = packet.ReadShort(); ushort responce = packet.ReadShort(); int HPindex = packet.ReadShort(); AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId); if (keep == null || !(GameServer.ServerRules.IsSameRealm(client.Player, (GameKeepComponent)keep.KeepComponents[wallId], true) || client.Account.PrivLevel > 1)) { return; } if (responce == 0x00) //show info { client.Out.SendKeepComponentInteract(((GameKeepComponent)keep.KeepComponents[wallId])); } else if (responce == 0x01) // click on hookpoint button { client.Out.SendKeepComponentHookPoint(((GameKeepComponent)keep.KeepComponents[wallId]), HPindex); } else if (responce == 0x02) //select an hookpoint { if (client.Account.PrivLevel > 1) { client.Out.SendMessage("DEBUG : selected hookpoint id " + HPindex, eChatType.CT_Say, eChatLoc.CL_SystemWindow); } GameKeepComponent hp = keep.KeepComponents[wallId] as GameKeepComponent; client.Out.SendClearKeepComponentHookPoint(hp, HPindex); client.Out.SendHookPointStore(hp.KeepHookPoints[HPindex] as GameKeepHookPoint); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { ushort keepId = packet.ReadShort(); ushort wallId = packet.ReadShort(); int hookpointID = packet.ReadShort(); ushort itemslot = packet.ReadShort(); int payType = packet.ReadByte(); //gold RP BP contrat??? int unk2 = packet.ReadByte(); int unk3 = packet.ReadByte(); int unk4 = packet.ReadByte(); // client.Player.Out.SendMessage("x="+unk2+"y="+unk3+"z="+unk4,eChatType.CT_Say,eChatLoc.CL_SystemWindow); AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId); if (keep == null) { return; } GameKeepComponent component = keep.KeepComponents[wallId] as GameKeepComponent; if (component == null) { return; } /*GameKeepHookPoint hookpoint = component.HookPoints[hookpointID] as GameKeepHookPoint; * if (hookpoint == null) return 1; */ HookPointInventory inventory = null; if (hookpointID > 0x80) { inventory = HookPointInventory.YellowHPInventory; //oil } else if (hookpointID > 0x60) { inventory = HookPointInventory.GreenHPInventory; //big siege } else if (hookpointID > 0x40) { inventory = HookPointInventory.LightGreenHPInventory; //small siege } else if (hookpointID > 0x20) { inventory = HookPointInventory.BlueHPInventory; //npc } else { inventory = HookPointInventory.RedHPInventory; //guard } if (inventory != null) { HookPointItem item = inventory.GetItem(itemslot); if (item != null) { item.Invoke(client.Player, payType, component.KeepHookPoints[hookpointID] as GameKeepHookPoint, component); } } }
public override bool WhisperReceive(GameLiving source, string str) { if (base.WhisperReceive(source, str)) { GamePlayer player = source as GamePlayer; if (player == null || player.InCombat) { return(false); } if (GameServer.ServerRules.IsSameRealm(this, player, true)) { switch (str.ToLower()) { case "movement": if (!player.CurrentRegion.IsRvR || player.Realm == Realm) { GameNPCHelper.CastSpellOnOwnerAndPets(this, player, SkillBase.GetSpellByID(GameHastener.SPEEDOFTHEREALMID), SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells), false); } break; case "strength": if (player.CurrentRegion.IsCapitalCity) { TargetObject = player; CastSpell(SkillBase.GetSpellByID(STROFTHEREALMID), SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells), false); } break; case "borderkeep": if ((player.CurrentRegion.IsCapitalCity || IsShroudedIslesStartZone(player.CurrentZone.ID)) && player.Level < 10) { if (!ServerProperties.Properties.BG_ZONES_OPENED && player.Client.Account.PrivLevel == (uint)ePrivLevel.Player) { SayTo(player, ServerProperties.Properties.BG_ZONES_CLOSED_MESSAGE); } else { AbstractGameKeep portalKeep = GameServer.KeepManager.GetBGPK(player); if (portalKeep != null) { player.MoveTo((ushort)portalKeep.Region, portalKeep.X, portalKeep.Y, portalKeep.Z, (ushort)portalKeep.Heading); } } } break; } } return(true); } return(false); }
public int CalcCX(GamePlayer player, AbstractGameKeep myKeep, double angle) { if (Math.Abs(Math.Sin(angle)) < 0.0001) //for approximations, == 0 wont work. { return((player.X - myKeep.X) / 148); } else { return((int)((148 * Math.Sin(angle) * myKeep.X - 148 * Math.Sin(angle) * player.X + player.Y - myKeep.Y) / (148 * Math.Sin(angle) - 148 * 148 * 2 * Math.Sin(angle) * Math.Cos(angle)))); } }
private string KeepStringBuilder(AbstractGameKeep keep) { string buffer = ""; buffer += keep.Name + ": " + GlobalConstants.RealmToName(keep.Realm); if (keep.Guild != null) { buffer += " (" + keep.Guild.Name + ")"; } buffer += "\n"; return(buffer); }
public ScoutMission(object owner) : base(owner) { eRealm realm = 0; if (owner is Group group) { realm = group.Leader.Realm; } else if (owner is GamePlayer player) { realm = player.Realm; } ArrayList list = new ArrayList(); ICollection <AbstractGameKeep> keeps; if (owner is Group group1) { keeps = GameServer.KeepManager.GetKeepsOfRegion(group1.Leader.CurrentRegionID); } else if (owner is GamePlayer gOwner) { keeps = GameServer.KeepManager.GetKeepsOfRegion(gOwner.CurrentRegionID); } else { keeps = new List <AbstractGameKeep>(); } foreach (AbstractGameKeep keep in keeps) { if (keep.IsPortalKeep) { continue; } if (keep.Realm != realm) { list.Add(keep); } } if (list.Count > 0) { _keep = list[Util.Random(list.Count - 1)] as AbstractGameKeep; } GameEventMgr.AddHandler(AreaEvent.PlayerEnter, new DOLEventHandler(Notify)); GameEventMgr.AddHandler(KeepEvent.KeepTaken, new DOLEventHandler(Notify)); }
public void HandlePacket(GameClient client, GSPacketIn packet) { ushort keepId = packet.ReadShort(); ushort wallId = packet.ReadShort(); int hookpointID = packet.ReadShort(); ushort itemslot = packet.ReadShort(); int payType = packet.ReadByte(); //gold RP BP contrat??? packet.ReadByte(); packet.ReadByte(); packet.ReadByte(); AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId); if (keep == null) { return; } GameKeepComponent component = keep.KeepComponents[wallId] as GameKeepComponent; if (component == null) { return; } HookPointInventory inventory = null; if (hookpointID > 0x80) { inventory = HookPointInventory.YellowHPInventory; // oil } else if (hookpointID > 0x60) { inventory = HookPointInventory.GreenHPInventory; // big siege } else if (hookpointID > 0x40) { inventory = HookPointInventory.LightGreenHPInventory; // small siege } else if (hookpointID > 0x20) { inventory = HookPointInventory.BlueHPInventory; // npc } else { inventory = HookPointInventory.RedHPInventory; // guard } HookPointItem item = inventory?.GetItem(itemslot); item?.Invoke(client.Player, payType, component.HookPoints[hookpointID], component); }
public int CalcCY(GamePlayer player, AbstractGameKeep myKeep, double angle) { if (Math.Abs(Math.Sin(angle)) < 0.0001) { return((myKeep.Y - player.Y) / 148); } else { int cx = (int)((148 * Math.Sin(angle) * myKeep.X - 148 * Math.Sin(angle) * player.X + player.Y - myKeep.Y) / (148 * Math.Sin(angle) - 148 * 148 * 2 * Math.Sin(angle) * Math.Cos(angle))); return((int)((myKeep.Y - player.Y + 148 * Math.Sin(angle) * cx) / (148 * Math.Cos(angle)))); } }
public RaizeMission(object owner) : base(owner) { eRealm realm = 0; if (owner is Group) { realm = (owner as Group).Leader.Realm; } else if (owner is GamePlayer) { realm = (owner as GamePlayer).Realm; } ArrayList list = new ArrayList(); ICollection <AbstractGameKeep> keeps; if (owner is Group) { keeps = GameServer.KeepManager.GetKeepsOfRegion((owner as Group).Leader.CurrentRegionID); } else if (owner is GamePlayer) { keeps = GameServer.KeepManager.GetKeepsOfRegion((owner as GamePlayer).CurrentRegionID); } else { keeps = new List <AbstractGameKeep>(); } foreach (AbstractGameKeep keep in keeps) { if (keep.IsPortalKeep) { continue; } if (keep is GameKeepTower && keep.Realm != realm) { list.Add(keep); } } if (list.Count > 0) { m_keep = list[Util.Random(list.Count - 1)] as AbstractGameKeep; } GameEventMgr.AddHandler(KeepEvent.TowerRaized, new DOLEventHandler(Notify)); }
private static void CheckIfPlayerLogsNearEnemyKeepAndMoveIfNecessary(GamePlayer player) { if (player.CurrentRegion.IsInstance) { if (WorldMgr.RvRLinkDeadPlayers.ContainsKey(player.InternalID)) { WorldMgr.RvRLinkDeadPlayers.Remove(player.InternalID); } return; } int gracePeriodInMinutes = 0; Int32.TryParse(Properties.RVR_LINK_DEATH_RELOG_GRACE_PERIOD, out gracePeriodInMinutes); AbstractGameKeep keep = GameServer.KeepManager.GetKeepCloseToSpot(player.CurrentRegionID, player, WorldMgr.VISIBILITY_DISTANCE); if (keep != null && player.Client.Account.PrivLevel == 1 && GameServer.KeepManager.IsEnemy(keep, player)) { if (WorldMgr.RvRLinkDeadPlayers.ContainsKey(player.InternalID)) { if (DateTime.Now.Subtract(new TimeSpan(0, gracePeriodInMinutes, 0)) <= WorldMgr.RvRLinkDeadPlayers[player.InternalID]) { SendMessageAndMoveToSafeLocation(player); } } else { SendMessageAndMoveToSafeLocation(player); } } var linkDeadPlayerIds = new string[WorldMgr.RvRLinkDeadPlayers.Count]; WorldMgr.RvRLinkDeadPlayers.Keys.CopyTo(linkDeadPlayerIds, 0); foreach (string playerId in linkDeadPlayerIds) { if (playerId != null && DateTime.Now.Subtract(new TimeSpan(0, gracePeriodInMinutes, 0)) > WorldMgr.RvRLinkDeadPlayers[playerId]) { WorldMgr.RvRLinkDeadPlayers.Remove(playerId); } } }
private static void CheckKeepChain(int[] chain) { GameRelicDoor door = GetRelicGateByChain(chain); if (door == null) { return; } foreach (int keepid in chain) { AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepid); if (keep == null) { continue; } // if the door is open, we see if we own a keep if (door.State == eDoorState.Open) { if (keep.Realm != keep.OriginalRealm) { continue; } door.CloseDoor(); } // if the door is closed, we check if the line should open it else { if (keep.Realm == keep.OriginalRealm) { continue; } door.OpenDoor(); } } }
/// <summary> /// Constructs a new KeepEventArgs /// </summary> public KeepEventArgs(AbstractGameKeep keep) { m_keep = keep; }
/// <summary> /// Called on every timer tick /// </summary> protected override void OnTick() { var player = (GamePlayer)m_actionSource; if (player == null) { return; } // log.DebugFormat("Dialog - response: {0}, messageType: {1}, data1: {2}, data2: {3}, data3: {4}", m_response, m_messageType, m_data1, m_data2, m_data3); switch ((eDialogCode)m_messageType) { case eDialogCode.CustomDialog: { if (m_data2 == 0x01) { CustomDialogResponse callback; lock (player) { callback = player.CustomDialogCallback; player.CustomDialogCallback = null; } if (callback == null) { return; } callback(player, m_response); } break; } case eDialogCode.GuildInvite: { var guildLeader = WorldMgr.GetObjectByIDFromRegion(player.CurrentRegionID, (ushort)m_data1) as GamePlayer; if (m_response == 0x01) //accept { if (guildLeader == null) { player.Out.SendMessage("You need to be in the same region as the guild leader to accept an invitation.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (player.Guild != null) { player.Out.SendMessage("You are still in a guild, you'll have to leave it first.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (guildLeader.Guild != null) { guildLeader.Guild.AddPlayer(player); return; } player.Out.SendMessage("Player doing the invite is not in a guild!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (guildLeader != null) { guildLeader.Out.SendMessage(player.Name + " declined your invite.", eChatType.CT_System, eChatLoc.CL_SystemWindow); } return; } case eDialogCode.GuildLeave: { if (m_response == 0x01) //accepte { if (player.Guild == null) { player.Out.SendMessage("You are not in a guild.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } player.Guild.RemovePlayer(player.Name, player); } else { player.Out.SendMessage("You decline to quit your guild.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } break; } case eDialogCode.QuestSubscribe: { var questNPC = (GameLiving)WorldMgr.GetObjectByIDFromRegion(player.CurrentRegionID, (ushort)m_data2); if (questNPC == null) { return; } var args = new QuestEventArgs(questNPC, player, (ushort)m_data1); if (m_response == 0x01) // accept { // TODO add quest to player // Note: This is done withing quest code since we have to check requirements, etc for each quest individually // i'm reusing the questsubscribe command for quest abort since its 99% the same, only different event dets fired player.Notify(m_data3 == 0x01 ? GamePlayerEvent.AbortQuest : GamePlayerEvent.AcceptQuest, player, args); return; } player.Notify(m_data3 == 0x01 ? GamePlayerEvent.ContinueQuest : GamePlayerEvent.DeclineQuest, player, args); return; } case eDialogCode.GroupInvite: { if (m_response == 0x01) { GameClient cln = WorldMgr.GetClientFromID(m_data1); if (cln == null) { return; } GamePlayer groupLeader = cln.Player; if (groupLeader == null) { return; } if (player.Group != null) { player.Out.SendMessage("You are still in a group.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (!GameServer.ServerRules.IsAllowedToGroup(groupLeader, player, false)) { return; } if (player.InCombatPvE) { player.Out.SendMessage("You can't join a group while in combat!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (groupLeader.Group != null) { if (groupLeader.Group.Leader != groupLeader) { return; } if (groupLeader.Group.MemberCount >= ServerProperties.Properties.GROUP_MAX_MEMBER) { player.Out.SendMessage("The group is full.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } groupLeader.Group.AddMember(player); GameEventMgr.Notify(GamePlayerEvent.AcceptGroup, player); return; } var group = new Group(groupLeader); GroupMgr.AddGroup(group); group.AddMember(groupLeader); group.AddMember(player); GameEventMgr.Notify(GamePlayerEvent.AcceptGroup, player); return; } break; } case eDialogCode.KeepClaim: { if (m_response == 0x01) { if (player.Guild == null) { player.Out.SendMessage("You have to be a member of a guild, before you can use any of the commands!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } AbstractGameKeep keep = GameServer.KeepManager.GetKeepCloseToSpot(player.CurrentRegionID, player.Position, WorldMgr.VISIBILITY_DISTANCE); if (keep == null) { player.Out.SendMessage("You have to be near the keep to claim it.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (keep.CheckForClaim(player)) { keep.Claim(player); } break; } break; } case eDialogCode.HousePayRent: { if (m_response == 0x00) { if (player.TempProperties.getProperty <long>(HousingConstants.MoneyForHouseRent, -1) != -1) { player.TempProperties.removeProperty(HousingConstants.MoneyForHouseRent); } if (player.TempProperties.getProperty <long>(HousingConstants.BPsForHouseRent, -1) != -1) { player.TempProperties.removeProperty(HousingConstants.BPsForHouseRent); } player.TempProperties.removeProperty(HousingConstants.HouseForHouseRent); return; } var house = player.TempProperties.getProperty <House>(HousingConstants.HouseForHouseRent, null); var moneyToAdd = player.TempProperties.getProperty <long>(HousingConstants.MoneyForHouseRent, -1); var bpsToMoney = player.TempProperties.getProperty <long>(HousingConstants.BPsForHouseRent, -1); if (moneyToAdd != -1) { // if we're giving money and already have some in the lockbox, make sure we don't // take more than what would cover 4 weeks of rent. if (moneyToAdd + house.KeptMoney > HouseMgr.GetRentByModel(house.Model) * ServerProperties.Properties.RENT_LOCKBOX_PAYMENTS) { moneyToAdd = (HouseMgr.GetRentByModel(house.Model) * ServerProperties.Properties.RENT_LOCKBOX_PAYMENTS) - house.KeptMoney; } // take the money from the player if (!player.RemoveMoney(moneyToAdd)) { return; } InventoryLogging.LogInventoryAction(player, "(HOUSE;" + house.HouseNumber + ")", eInventoryActionType.Other, moneyToAdd); // add the money to the lockbox house.KeptMoney += moneyToAdd; // save the house and the player house.SaveIntoDatabase(); player.SaveIntoDatabase(); // notify the player of what we took and how long they are prepaid for player.Out.SendMessage("You deposit " + Money.GetString(moneyToAdd) + " in the lockbox.", eChatType.CT_System, eChatLoc.CL_SystemWindow); player.Out.SendMessage("The lockbox now has " + Money.GetString(house.KeptMoney) + " in it. The weekly payment is " + Money.GetString(HouseMgr.GetRentByModel(house.Model)) + ".", eChatType.CT_System, eChatLoc.CL_SystemWindow); player.Out.SendMessage("The house is now prepaid for the next " + (house.KeptMoney / HouseMgr.GetRentByModel(house.Model)) + " payments.", eChatType.CT_System, eChatLoc.CL_SystemWindow); // clean up player.TempProperties.removeProperty(HousingConstants.MoneyForHouseRent); } else { if (bpsToMoney + house.KeptMoney > HouseMgr.GetRentByModel(house.Model) * ServerProperties.Properties.RENT_LOCKBOX_PAYMENTS) { bpsToMoney = (HouseMgr.GetRentByModel(house.Model) * ServerProperties.Properties.RENT_LOCKBOX_PAYMENTS) - house.KeptMoney; } if (!player.RemoveBountyPoints(Money.GetGold(bpsToMoney))) { return; } // add the bps to the lockbox house.KeptMoney += bpsToMoney; // save the house and the player house.SaveIntoDatabase(); player.SaveIntoDatabase(); // notify the player of what we took and how long they are prepaid for player.Out.SendMessage("You deposit " + Money.GetString(bpsToMoney) + " in the lockbox.", eChatType.CT_System, eChatLoc.CL_SystemWindow); player.Out.SendMessage("The lockbox now has " + Money.GetString(house.KeptMoney) + " in it. The weekly payment is " + Money.GetString(HouseMgr.GetRentByModel(house.Model)) + ".", eChatType.CT_System, eChatLoc.CL_SystemWindow); player.Out.SendMessage("The house is now prepaid for the next " + (house.KeptMoney / HouseMgr.GetRentByModel(house.Model)) + " payments.", eChatType.CT_System, eChatLoc.CL_SystemWindow); // clean up player.TempProperties.removeProperty(HousingConstants.BPsForHouseRent); } // clean up player.TempProperties.removeProperty(HousingConstants.MoneyForHouseRent); break; } case eDialogCode.MasterLevelWindow: { player.Out.SendMasterLevelWindow(m_response); break; } } }
public CaptureMission(eCaptureType type, object owner, string hint) : base(owner) { eRealm realm = eRealm.None; if (owner is Group group) { realm = group.Leader.Realm; } else if (owner is GamePlayer) { realm = ((GamePlayer)owner).Realm; } ArrayList list = new ArrayList(); switch (type) { case eCaptureType.Tower: { ICollection <AbstractGameKeep> keeps; if (owner is Group group1) { keeps = GameServer.KeepManager.GetKeepsOfRegion(group1.Leader.CurrentRegionID); } else if (owner is GamePlayer) { keeps = GameServer.KeepManager.GetKeepsOfRegion(((GamePlayer)owner).CurrentRegionID); } else { keeps = new List <AbstractGameKeep>(); } foreach (AbstractGameKeep keep in keeps) { if (keep.IsPortalKeep) { continue; } if (keep is GameKeepTower && keep.Realm != realm) { list.Add(keep); } } break; } case eCaptureType.Keep: { ICollection <AbstractGameKeep> keeps; if (owner is Group group1) { keeps = GameServer.KeepManager.GetKeepsOfRegion(group1.Leader.CurrentRegionID); } else if (owner is GamePlayer gOwner) { keeps = GameServer.KeepManager.GetKeepsOfRegion(gOwner.CurrentRegionID); } else { keeps = new List <AbstractGameKeep>(); } foreach (AbstractGameKeep keep in keeps) { if (keep.IsPortalKeep) { continue; } if (keep is GameKeep && keep.Realm != realm) { list.Add(keep); } } break; } } if (list.Count > 0) { if (hint != string.Empty) { foreach (AbstractGameKeep keep in list) { if (keep.Name.ToLower().Contains(hint)) { _keep = keep; break; } } } if (_keep == null) { _keep = list[Util.Random(list.Count - 1)] as AbstractGameKeep; } } GameEventMgr.AddHandler(KeepEvent.KeepTaken, new DOLEventHandler(Notify)); }
/// <summary> /// The command handler itself /// </summary> /// <param name="client">The client using the command</param> /// <param name="args">The command arguments</param> public void OnCommand(GameClient client, string[] args) { if (args.Length == 1) { DisplaySyntax(client); return; } switch (args[1].ToLower()) { #region Create case "create": { GameKeepGuard guard = null; if (args.Length < 3) { DisplaySyntax(client); return; } switch (args[2].ToLower()) { #region Lord case "lord": { guard = new GuardLord(); break; } #endregion Lord #region Fighter case "fighter": { guard = new GuardFighter(); break; } #endregion Fighter #region Archer case "archer": { if (args.Length > 3) { guard = new GuardStaticArcher(); } else { guard = new GuardArcher(); } break; } #endregion Archer #region Healer case "healer": { guard = new GuardHealer(); break; } #endregion Healer #region Stealther case "stealther": { guard = new GuardStealther(); break; } #endregion Stealther #region Caster case "caster": { if (args.Length > 3) { guard = new GuardStaticCaster(); } else { guard = new GuardCaster(); } break; } #endregion Caster #region Hastener case "hastener": { guard = new FrontierHastener(); break; } #endregion Hastener #region Mission case "mission": { guard = new MissionMaster(); break; } #endregion Mission #region Patrol case "patrol": { if (args.Length < 4) { DisplayMessage(client, "You need to provide a name for this patrol."); return; } AbstractGameKeep.eKeepType keepType = AbstractGameKeep.eKeepType.Any; if (args.Length < 5) { DisplayMessage(client, "You need to provide the type of keep this patrol works with."); int i = 0; foreach (string str in Enum.GetNames(typeof(Keeps.AbstractGameKeep.eKeepType))) { DisplayMessage(client, "#" + i + ": " + str); i++; } return; } try { keepType = (AbstractGameKeep.eKeepType)Convert.ToInt32(args[4]); } catch { DisplayMessage(client, "Type of keep specified was not valid."); return; } if (client.Player.TargetObject is GameKeepComponent == false) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Create.NoKCompTarget")); return; } GameKeepComponent c = client.Player.TargetObject as GameKeepComponent;; Patrol p = new Patrol(c); p.PatrolID = args[3]; p.KeepType = keepType; p.SpawnPosition = PositionMgr.CreatePatrolPosition(p.PatrolID, c, client.Player, keepType); p.PatrolID = p.SpawnPosition.TemplateID; p.InitialiseGuards(); DisplayMessage(client, "Patrol created for Keep Type " + Enum.GetName(typeof(AbstractGameKeep.eKeepType), keepType)); return; } #endregion Patrol } if (guard == null) { DisplaySyntax(client); return; } GameKeepComponent component = client.Player.TargetObject as GameKeepComponent; if (component != null) { int height = component.Height; if (args.Length > 4) { int.TryParse(args[4], out height); } DBKeepPosition pos = PositionMgr.CreatePosition(guard.GetType(), height, client.Player, Guid.NewGuid().ToString(), component); //PositionMgr.AddPosition(pos); //PositionMgr.FillPositions(); DBKeepPosition[] list = component.Positions[pos.TemplateID] as DBKeepPosition[]; if (list == null) { list = new DBKeepPosition[4]; component.Positions[pos.TemplateID] = list; } list[pos.Height] = pos; component.LoadPositions(); component.FillPositions(); } else { guard.CurrentRegion = client.Player.CurrentRegion; guard.X = client.Player.X; guard.Y = client.Player.Y; guard.Z = client.Player.Z; guard.Heading = client.Player.Heading; guard.Realm = guard.CurrentZone.Realm; guard.LoadedFromScript = false; guard.SaveIntoDatabase(); foreach (AbstractArea area in guard.CurrentAreas) { if (area is KeepArea) { AbstractGameKeep keep = (area as KeepArea).Keep; guard.Component = new GameKeepComponent(); guard.Component.Keep = keep; break; } } TemplateMgr.RefreshTemplate(guard); guard.AddToWorld(); if (guard.Component != null && guard.Component.Keep != null) { guard.Component.Keep.Guards.Add(DOL.Database.UniqueID.IDGenerator.GenerateID(), guard); } } PositionMgr.FillPositions(); DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Create.GuardAdded")); break; } #endregion Create #region Position case "position": { switch (args[2].ToLower()) { #region Add case "add": { if (!(client.Player.TargetObject is GameKeepGuard)) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Position.TargetGuard")); return; } if (args.Length != 4) { DisplaySyntax(client); return; } byte height = byte.Parse(args[3]); //height = KeepMgr.GetHeightFromLevel(height); GameKeepGuard guard = client.Player.TargetObject as GameKeepGuard; if (PositionMgr.GetPosition(guard) != null) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Position.PAlreadyAss", height)); return; } DBKeepPosition pos = PositionMgr.CreatePosition(guard.GetType(), height, client.Player, guard.TemplateID, guard.Component); PositionMgr.AddPosition(pos); PositionMgr.FillPositions(); DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Position.GuardPAdded")); break; } #endregion Add #region Remove case "remove": { if (!(client.Player.TargetObject is GameKeepGuard)) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Position.TargetGuard")); return; } GameKeepGuard guard = client.Player.TargetObject as GameKeepGuard; DBKeepPosition pos = guard.Position; if (pos != null) { PositionMgr.RemovePosition(pos); if (guard.LoadedFromScript) { if (guard.PatrolGroup != null) { foreach (GameKeepGuard g in guard.PatrolGroup.PatrolGuards) { g.Delete(); } } else { guard.Delete(); } } } PositionMgr.FillPositions(); DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Position.GuardRemoved")); break; } #endregion Remove #region Default default: { DisplaySyntax(client); return; } #endregion Default } break; } #endregion Position #region Path case "path": { switch (args[2].ToLower()) { #region Create case "create": { RemoveAllTempPathObjects(client); PathPoint startpoint = new PathPoint(client.Player.X, client.Player.Y, client.Player.Z, 100000, ePathType.Once); client.Player.TempProperties.setProperty(TEMP_PATH_FIRST, startpoint); client.Player.TempProperties.setProperty(TEMP_PATH_LAST, startpoint); client.Player.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Path.CreationStarted"), eChatType.CT_System, eChatLoc.CL_SystemWindow); CreateTempPathObject(client, startpoint, "TMP PP 1"); break; } #endregion Create #region Add case "add": { PathPoint path = (PathPoint)client.Player.TempProperties.getProperty <object>(TEMP_PATH_LAST, null); if (path == null) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Path.NoPathCreatedYet")); return; } int speedlimit = 1000; if (args.Length == 4) { try { speedlimit = int.Parse(args[3]); } catch { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Path.NoValidSpLimit", args[2])); return; } } PathPoint newpp = new PathPoint(client.Player.X, client.Player.Y, client.Player.Z, speedlimit, path.Type); path.Next = newpp; newpp.Prev = path; client.Player.TempProperties.setProperty(TEMP_PATH_LAST, newpp); int len = 0; while (path.Prev != null) { len++; path = path.Prev; } len += 2; CreateTempPathObject(client, newpp, "TMP PP " + len); DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Path.PPAdded", len)); break; } #endregion Add #region Save case "save": { PathPoint path = (PathPoint)client.Player.TempProperties.getProperty <object>(TEMP_PATH_LAST, null); if (path == null) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Path.NoPathCreatedYet")); return; } GameKeepGuard guard = client.Player.TargetObject as GameKeepGuard; if (guard == null || guard.PatrolGroup == null) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Path.TargPatrolGuard")); return; } path.Type = ePathType.Loop; PositionMgr.SavePatrolPath(guard.TemplateID, path, guard.Component); DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepGuard.Path.Saved")); RemoveAllTempPathObjects(client); guard.PatrolGroup.InitialiseGuards(); PositionMgr.FillPositions(); DisplayMessage(client, "Patrol groups initialized!"); break; } #endregion Save #region Default default: { DisplaySyntax(client); return; } #endregion Default } break; } #endregion Path #region Default default: { DisplaySyntax(client); return; } #endregion Default } }
protected Teleport GetTeleportLocation(GamePlayer player, string text, eRealm realm) { // Battlegrounds are specials, as the teleport location depends on // the level of the player, so let's deal with that first. if (text.ToLower() == "battlegrounds") { if (!ServerProperties.Properties.BG_ZONES_OPENED && player.Client.Account.PrivLevel == (uint)ePrivLevel.Player) { SayTo(player, ServerProperties.Properties.BG_ZONES_CLOSED_MESSAGE); } else { AbstractGameKeep portalKeep = GameServer.KeepManager.GetBGPK(player); if (portalKeep != null) { Teleport teleport = new Teleport(); teleport.TeleportID = "battlegrounds"; teleport.Realm = (byte)portalKeep.Realm; teleport.RegionID = portalKeep.Region; teleport.X = portalKeep.X; teleport.Y = portalKeep.Y; teleport.Z = portalKeep.Z; teleport.Heading = 0; return(teleport); } else { if (player.Client.Account.PrivLevel > (uint)ePrivLevel.Player) { player.Out.SendMessage("No portal keep found.", eChatType.CT_Skill, eChatLoc.CL_SystemWindow); } return(null); } } } // Another special case is personal house, as there is no location // that will work for every player. if (text.ToLower() == "personal") { House house = HouseMgr.GetHouseByPlayer(player); if (house == null) { text = "entrance"; // Fall through, port to housing entrance. } else { IGameLocation location = house.OutdoorJumpPoint; Teleport teleport = new Teleport(); teleport.TeleportID = "personal"; teleport.Realm = (int)player.Realm; teleport.RegionID = location.RegionID; teleport.X = (int)location.Position.X; teleport.Y = (int)location.Position.Y; teleport.Z = (int)location.Position.Z; teleport.Heading = location.Heading; return(teleport); } } // Yet another special case the port to the 'hearth' what means // that the player will be ported to the defined house bindstone if (text.ToLower() == "hearth") { // Check if player has set a house bind if (!(player.BindHouseRegion > 0)) { SayTo(player, "Sorry, you haven't set any house bind point yet."); return(null); } // Check if the house at the player's house bind location still exists ArrayList houses = (ArrayList)HouseMgr.GetHousesCloseToSpot((ushort)player. BindHouseRegion, player.BindHouseXpos, player. BindHouseYpos, 700); if (houses.Count == 0) { SayTo(player, "I'm afraid I can't teleport you to your hearth since the house at your " + "house bind location has been torn down."); return(null); } // Check if the house at the player's house bind location contains a bind stone House targetHouse = (House)houses[0]; IDictionary <uint, DBHouseHookpointItem> hookpointItems = targetHouse.HousepointItems; Boolean hasBindstone = false; foreach (KeyValuePair <uint, DBHouseHookpointItem> targetHouseItem in hookpointItems) { if (((GameObject)targetHouseItem.Value.GameObject).GetName(0, false).ToLower().EndsWith("bindstone")) { hasBindstone = true; break; } } if (!hasBindstone) { SayTo(player, "I'm sorry to tell that the bindstone of your current house bind location " + "has been removed, so I'm not able to teleport you there."); return(null); } // Check if the player has the permission to bind at the house bind stone if (!targetHouse.CanBindInHouse(player)) { SayTo(player, "You're no longer allowed to bind at the house bindstone you've previously " + "chosen, hence I'm not allowed to teleport you there."); return(null); } Teleport teleport = new Teleport(); teleport.TeleportID = "hearth"; teleport.Realm = (int)player.Realm; teleport.RegionID = player.BindHouseRegion; teleport.X = player.BindHouseXpos; teleport.Y = player.BindHouseYpos; teleport.Z = player.BindHouseZpos; teleport.Heading = player.BindHouseHeading; return(teleport); } if (text.ToLower() == "guild") { House house = HouseMgr.GetGuildHouseByPlayer(player); if (house == null) { return(null); // no teleport when guild house not found } else { IGameLocation location = house.OutdoorJumpPoint; Teleport teleport = new Teleport(); teleport.TeleportID = "guild house"; teleport.Realm = (int)player.Realm; teleport.RegionID = location.RegionID; teleport.X = (int)location.Position.X; teleport.Y = (int)location.Position.Y; teleport.Z = (int)location.Position.Z; teleport.Heading = location.Heading; return(teleport); } } // Find the teleport location in the database. return(WorldMgr.GetTeleportLocation(realm, String.Format(":{0}", text))); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int code = packet.ReadByte(); int RealmMap = packet.ReadByte(); int keepId = packet.ReadByte(); if (client == null || client.Player == null) { return; } //hack fix new keep ids else if ((int)client.Version >= (int)GameClient.eClientVersion.Version190 && (int)client.Version < (int)GameClient.eClientVersion.Version1115) { if (keepId >= 82) { keepId -= 7; } else if (keepId >= 62) { keepId -= 12; } } switch (code) { //warmap open //warmap update case 0: { client.Player.WarMapPage = (byte)RealmMap; break; } case 1: { client.Out.SendWarmapUpdate(GameServer.KeepManager.GetKeepsByRealmMap(client.Player.WarMapPage)); WarMapMgr.SendFightInfo(client); break; } //teleport case 2: { client.Out.SendWarmapUpdate(GameServer.KeepManager.GetKeepsByRealmMap(client.Player.WarMapPage)); WarMapMgr.SendFightInfo(client); if (client.Account.PrivLevel == (int)ePrivLevel.Player && (client.Player.InCombat || client.Player.CurrentRegionID != 163 || GameRelic.IsPlayerCarryingRelic(client.Player))) { return; } AbstractGameKeep keep = null; if (keepId > 6) { keep = GameServer.KeepManager.GetKeepByID(keepId); } if (keep == null && keepId > 6) { return; } if (client.Account.PrivLevel == (int)ePrivLevel.Player) { bool found = false; if (keep != null) { // if we are requesting to teleport to a keep we need to check that keeps requirements first if (keep.Realm != client.Player.Realm) { return; } if (keep is GameKeep && ((keep as GameKeep).OwnsAllTowers == false || keep.InCombat)) { return; } // Missing: Supply line check } if (client.Player.CurrentRegionID == 163) { // We are in the frontiers and all keep requirements are met or we are not near a keep // this may be a portal stone in the RvR village, for example foreach (GameStaticItem item in client.Player.GetItemsInRadius(WorldMgr.INTERACT_DISTANCE)) { if (item is FrontiersPortalStone) { found = true; break; } } } if (!found) { client.Player.Out.SendMessage("You cannot teleport unless you are near a valid portal stone.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } } int x = 0; int y = 0; int z = 0; ushort heading = 0; switch (keepId) { //sauvage case 1: //snowdonia case 2: //svas case 3: //vind case 4: //ligen case 5: //cain case 6: { GameServer.KeepManager.GetBorderKeepLocation(keepId, out x, out y, out z, out heading); break; } default: { if (keep != null && keep is GameKeep) { FrontiersPortalStone stone = keep.TeleportStone; if (stone != null) { heading = stone.Heading; z = stone.Z; stone.GetTeleportLocation(out x, out y); } else { x = keep.X; y = keep.Y; z = keep.Z + 150; heading = keep.Heading; } } break; } } if (x != 0) { client.Player.MoveTo(163, x, y, z, heading); } break; } } }
/// <summary> /// This method is called from the Interaction with the GameStaticItem /// </summary> /// <param name="player"></param> protected virtual void PlayerTakesRelic(GamePlayer player) { if (player.TempProperties.getProperty <object>(PLAYER_CARRY_RELIC_WEAK, null) != null) { player.Out.SendMessage("You are already carrying a relic.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (player.IsStealthed) { player.Out.SendMessage("You cannot carry a relic while stealthed.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (!player.IsAlive) { player.Out.SendMessage("You are dead!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (IsMounted) { AbstractGameKeep keep = GameServer.KeepManager.GetKeepCloseToSpot(m_currentRelicPad.CurrentRegionID, m_currentRelicPad, WorldMgr.VISIBILITY_DISTANCE); log.DebugFormat("keep {0}", keep); if (keep != null && keep.Realm != player.Realm) { player.Out.SendMessage("You must capture this keep before taking a relic.", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } } if (player.Inventory.AddItem(eInventorySlot.FirstEmptyBackpack, m_item)) { if (m_item == null) { log.Warn("GameRelic: Could not retrive " + Name + " as InventoryItem on player " + player.Name); } InventoryLogging.LogInventoryAction(this, player, eInventoryActionType.Other, m_item.Template, m_item.Count); m_currentCarrier = player; player.TempProperties.setProperty(PLAYER_CARRY_RELIC_WEAK, this); player.Out.SendUpdateMaxSpeed(); if (IsMounted) { m_currentRelicPad.RemoveRelic(this); ReturnRelicPad = m_currentRelicPad; LastRealm = m_currentRelicPad.Realm; // save who owned this in case of server restart while relic is off pad m_currentRelicPad = null; } RemoveFromWorld(); SaveIntoDatabase(); Realm = 0; SetHandlers(player, true); StartPlayerTimer(player); if (m_returnRelicTimer != null) { m_returnRelicTimer.Stop(); m_returnRelicTimer = null; } } else { player.Out.SendMessage("You dont have enough space in your backpack to carry this.", eChatType.CT_System, eChatLoc.CL_SystemWindow); } }
public void OnCommand(GameClient client, string[] args) { if (args.Length == 1) { DisplaySyntax(client); return; } AbstractGameKeep myKeep = GameServer.KeepManager.GetKeepCloseToSpot(client.Player.CurrentRegionID, client.Player, WorldMgr.OBJ_UPDATE_DISTANCE); if (myKeep == null) { DisplayMessage(client, "You are not near a keep."); } switch (args[1]) { #region Create case "create": { if (args.Length < 3) { int i = 0; foreach (string str in Enum.GetNames(typeof(GameKeepComponent.eComponentSkin))) { client.Out.SendMessage("#" + i + ": " + str, eChatType.CT_System, eChatLoc.CL_SystemWindow); i++; } DisplaySyntax(client); return; } if (myKeep == null) { DisplaySyntax(client); return; } int skin = 0; try { skin = Convert.ToInt32(args[2]); } catch { int i = 0; foreach (string str in Enum.GetNames(typeof(GameKeepComponent.eComponentSkin))) { client.Out.SendMessage("#" + i + ": " + str, eChatType.CT_System, eChatLoc.CL_SystemWindow); i++; } DisplaySyntax(client); return; } if (args.Length >= 4) { int keepid = 0; try { keepid = Convert.ToInt32(args[3]); myKeep = GameServer.KeepManager.GetKeepByID(keepid); } catch { DisplaySyntax(client); return; } } GameKeepComponent component = new GameKeepComponent(); component.X = client.Player.X; component.Y = client.Player.Y; component.Z = client.Player.Z; component.ComponentHeading = (client.Player.Heading - myKeep.Heading) / 1024; component.Heading = (ushort)(component.ComponentHeading * 1024 + myKeep.Heading); component.Keep = myKeep; //todo good formula //component.ComponentX = (component.X - myKeep.X) / 148; //component.ComponentY = (component.Y - myKeep.Y) / 148; double angle = myKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360; //component.ComponentX = (int)((148 * Math.Sin(angle) * myKeep.X - 148 * Math.Sin(angle) * client.Player.X + client.Player.Y - myKeep.Y) // / (148 * Math.Sin(angle) - 148 * 148 * 2 * Math.Sin(angle) * Math.Cos(angle))); //component.ComponentY = (int)((myKeep.Y - client.Player.Y + 148 * Math.Sin(angle) * component.ComponentX) / (148 * Math.Cos(angle))); component.ComponentX = CalcCX(client.Player, myKeep, angle); component.ComponentY = CalcCY(client.Player, myKeep, angle); /* * x = (component.X-myKeep.X)/148 = a*cos(t) - b*sin(t) * y = (component.Y-myKeep.Y)/148 = a*sin(t) + b*cos(t) * a = sqrt((x+b*sin(t))^2 + (y-b*cos(t))^2) * a = sqrt(x²+y²+b² +2*x*b*sin(t)-2*y*b*cos(t)) * b = sqrt((x-a*cos(t))^2 + (y-a*sin(t))^2) * b = sqrt(x²+y²+a²-2*x*a*cos(t)-2*y*a*sin(t)) * 0 = 2x²+2y²-2*x*a*cos(t)-2*y*a*sin(t)+2*x*sqrt(x²+y²+a²-2*x*a*cos(t)-2*y*a*sin(t))*sin(t)-2*y*sqrt(x²+y²+a²-2*x*a*cos(t)-2*y*a*sin(t))*cos(t) * pfff * so must find an other way to find it.... */ component.Name = myKeep.Name; component.Model = INVISIBLE_MODEL; component.Skin = skin; component.Level = (byte)myKeep.Level; component.CurrentRegion = client.Player.CurrentRegion; component.Health = component.MaxHealth; component.ID = myKeep.KeepComponents.Count; component.Keep.KeepComponents.Add(component); component.SaveInDB = true; component.AddToWorld(); component.SaveIntoDatabase(); client.Out.SendKeepInfo(myKeep); client.Out.SendKeepComponentInfo(component); client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepComponents.Create.KCCreated"), eChatType.CT_System, eChatLoc.CL_SystemWindow); } break; #endregion Create #region Move case "move": { GameKeepComponent component = client.Player.TargetObject as GameKeepComponent; component.X = client.Player.X; component.Y = client.Player.Y; component.Z = client.Player.Z; component.ComponentHeading = (client.Player.Heading - myKeep.Heading) / 1024; component.Heading = (ushort)(component.ComponentHeading * 1024 + myKeep.Heading); component.Keep = myKeep; //todo good formula //component.ComponentX = (component.X - myKeep.X) / 148; //component.ComponentY = (myKeep.Y - component.Y) / 148; double angle = myKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360; //component.ComponentX = (int)((148 * Math.Sin(angle) * myKeep.X - 148 * Math.Sin(angle) * client.Player.X + client.Player.Y - myKeep.Y) // / (148 * Math.Sin(angle) - 148 * 148 * 2 * Math.Sin(angle) * Math.Cos(angle))); //component.ComponentY = (int)((myKeep.Y - client.Player.Y + 148 * Math.Sin(angle) * component.ComponentX) / (148 * Math.Cos(angle))); component.ComponentX = CalcCX(client.Player, myKeep, angle); component.ComponentY = CalcCY(client.Player, myKeep, angle); client.Out.SendKeepInfo(myKeep); client.Out.SendKeepComponentInfo(component); client.Out.SendKeepComponentDetailUpdate(component); client.Out.SendMessage("Component moved. Use /keepcomponent save to save, or reload to reload the original position.", eChatType.CT_System, eChatLoc.CL_SystemWindow); } break; #endregion #region Rotate case "rotate": { try { ushort amount = Convert.ToUInt16(args[2]); if (amount > 3) { amount = 3; } GameKeepComponent component = client.Player.TargetObject as GameKeepComponent; component.ComponentHeading = amount; component.Heading = (ushort)(component.ComponentHeading * 1024 + myKeep.Heading); client.Out.SendKeepInfo(myKeep); client.Out.SendKeepComponentInfo(component); client.Out.SendKeepComponentDetailUpdate(component); client.Out.SendMessage("Component rotated. Use /keepcomponent save to save, or reload to reload the original position.", eChatType.CT_System, eChatLoc.CL_SystemWindow); } catch { DisplayMessage(client, "/keepcomponent rotate [0 - 3]"); } } break; #endregion #region Skin case "skin": { if (args.Length < 3) { int i = 0; foreach (string str in Enum.GetNames(typeof(GameKeepComponent.eComponentSkin))) { client.Out.SendMessage("#" + i + ": " + str, eChatType.CT_System, eChatLoc.CL_SystemWindow); i++; } DisplaySyntax(client); return; } int skin = 0; try { skin = Convert.ToInt32(args[2]); } catch { DisplaySyntax(client); return; } GameKeepComponent component = client.Player.TargetObject as GameKeepComponent; if (component == null) { DisplaySyntax(client); return; } component.Skin = skin; foreach (GameClient cli in WorldMgr.GetClientsOfRegion(client.Player.CurrentRegionID)) { cli.Out.SendKeepComponentInfo(component); cli.Out.SendKeepComponentDetailUpdate(component); } //client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepComponents.Skin.YChangeSkin"), eChatType.CT_System, eChatLoc.CL_SystemWindow); client.Out.SendMessage("Component skin updated. Use /keepcomponent save to save, or reload to reload the original skin.", eChatType.CT_System, eChatLoc.CL_SystemWindow); } break; #endregion Skin #region Delete case "delete": { GameKeepComponent component = client.Player.TargetObject as GameKeepComponent; if (component == null) { DisplaySyntax(client); return; } component.RemoveFromWorld(); component.Delete(); component.DeleteFromDatabase(); client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepComponents.Delete.YDeleteKC"), eChatType.CT_System, eChatLoc.CL_SystemWindow); } break; #endregion Delete #region Save case "save": { GameKeepComponent component = client.Player.TargetObject as GameKeepComponent; if (component == null) { DisplaySyntax(client); return; } component.SaveIntoDatabase(); client.Out.SendMessage(string.Format("Saved ComponentID: {0}, KeepID: {1}, Skin: {2}, Health: {3}%", component.ID, (component.Keep == null ? "0" : component.Keep.KeepID.ToString()), component.Skin, component.HealthPercent), eChatType.CT_System, eChatLoc.CL_SystemWindow); } break; #endregion Save #region Reload case "reload": { GameKeepComponent component = client.Player.TargetObject as GameKeepComponent; if (component == null) { DisplaySyntax(client); return; } var dbcomponent = DOLDB <DBKeepComponent> .SelectObject(DB.Column(nameof(DBKeepComponent.KeepID)).IsEqualTo(component.Keep.KeepID).And(DB.Column(nameof(DBKeepComponent.ID)).IsEqualTo(component.ID))); component.ComponentX = dbcomponent.X; component.ComponentY = dbcomponent.Y; component.ComponentHeading = dbcomponent.Heading; component.Skin = dbcomponent.Skin; foreach (GameClient cli in WorldMgr.GetClientsOfRegion(client.Player.CurrentRegionID)) { cli.Out.SendKeepComponentInfo(component); cli.Out.SendKeepComponentDetailUpdate(component); } client.Out.SendMessage("Component Reloaded", eChatType.CT_System, eChatLoc.CL_SystemWindow); break; } #endregion Reload #region Default default: { DisplaySyntax(client); return; } #endregion Default } }
public KeepEventArgs(AbstractGameKeep keep, eRealm realm) { m_keep = keep; m_realm = realm; }