/// <summary> /// Sends a message to all players to notify them of the keep capture /// </summary> /// <param name="keep">The keep object</param> public static void BroadcastCapture(AbstractGameKeep keep) { string message = ""; if (keep.Realm != eRealm.None) { message = string.Format(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "PlayerManager.BroadcastCapture.Captured", GlobalConstants.RealmToName((eRealm)keep.Realm), keep.Name)); } else { message = string.Format(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "PlayerManager.BroadcastCapture.CapturedR0", GlobalConstants.RealmToName((eRealm)keep.Realm), keep.Name)); } /* switch (GameServer.Instance.Configuration.ServerType) { case eGameServerType.GST_Normal: { message = string.Format("The forces of {0} have captured {1}!", GlobalConstants.RealmToName((eRealm)keep.Realm), keep.Name); break; } case eGameServerType.GST_PvP: { string defeatersStr = ""; message = string.Format("The forces of {0} have defeated the defenders of {1}!", defeatersStr, keep.Name); break; } }*/ BroadcastMessage(message, eRealm.None); NewsMgr.CreateNews(message, keep.Realm, eNewsType.RvRGlobal, false); }
public static void SendLevelChangeMessage(AbstractGameKeep keep) { string message = "Your guild's keep " + keep.Name + " is now level " + keep.Level; if (keep.Level != ServerProperties.Properties.MAX_KEEP_LEVEL) message += ", it is on the way to level " + ServerProperties.Properties.MAX_KEEP_LEVEL.ToString(); SendMessageToGuild(message, keep.Guild); }
public override void SendKeepRemove(AbstractGameKeep keep) { GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepRemove)); pak.WriteShort((ushort)keep.KeepID); SendTCP(pak); }
public ScoutMission(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.Realm != realm) list.Add(keep); } if (list.Count > 0) m_keep = list[Util.Random(list.Count - 1)] as AbstractGameKeep; GameEventMgr.AddHandler(AreaEvent.PlayerEnter, new DOLEventHandler(Notify)); GameEventMgr.AddHandler(KeepEvent.KeepTaken, new DOLEventHandler(Notify)); }
public static void SendChangeLevelTimeMessage(AbstractGameKeep keep) { string message; string changeleveltext = ""; int nextlevel = 0; byte maxlevel = (byte)ServerProperties.Properties.MAX_KEEP_LEVEL; if (keep.Level < maxlevel) { changeleveltext = "upgrade"; nextlevel = keep.Level + 1; } else if (keep.Level > maxlevel) { changeleveltext = "downgrade"; nextlevel = keep.Level - 1; } else { return; } message = "Your guild is starting to " + changeleveltext + " its area " + keep.Name + " to level 10."; TimeSpan time = keep.ChangeLevelTimeRemaining; message += " It will take "; if (time.Hours > 0) message += time.Hours + " hour(s) "; if (time.Minutes > 0) message += time.Minutes + " minute(s) "; else message += time.Seconds + " second(s)"; message += " to reach the next level."; SendMessageToGuild(message, keep.Guild); }
public override void SendKeepRealmUpdate(AbstractGameKeep keep) { GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepRealmUpdate)); pak.WriteShort((ushort)keep.KeepID); pak.WriteByte((byte)keep.Realm); pak.WriteByte((byte)keep.Level); SendTCP(pak); }
public override void SendKeepInfo(AbstractGameKeep keep) { GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepInfo)); pak.WriteShort((ushort)keep.KeepID); pak.WriteShort(0);//zone id not sure pak.WriteInt((uint)keep.X); pak.WriteInt((uint)keep.Y); pak.WriteShort((ushort)keep.Heading); pak.WriteByte((byte)keep.Realm); pak.WriteByte((byte)keep.Level);//level(not sure) pak.WriteShort(0);//unk pak.WriteByte(0x57);//model= 5-8Bit =lvl 1-4bit = Keep Type //uncertain pak.WriteByte(0xB7);//unk SendTCP(pak); }
/// <summary> /// load component from db object /// </summary> public virtual void LoadFromDatabase(DBKeepComponent component, AbstractGameKeep keep) { Region myregion = WorldMgr.GetRegion((ushort)keep.Region); if (myregion == null) return; this.Keep = keep; //this.DBKeepComponent = component; base.LoadFromDatabase(component); //this x and y is for get object in radius double angle = keep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360; X = (int)(keep.X + ((sbyte)component.X * 148 * Math.Cos(angle) + (sbyte)component.Y * 148 * Math.Sin(angle))); Y = (int)(keep.Y - ((sbyte)component.Y * 148 * Math.Cos(angle) - (sbyte)component.X * 148 * Math.Sin(angle))); this.Z = keep.Z; // and this one for packet sent this.ComponentX = component.X; this.ComponentY = component.Y; this.ComponentHeading = (ushort)component.Heading; //need check to be sure for heading angle = (component.Heading * 90 + keep.Heading); if (angle > 360) angle -= 360; this.Heading = (ushort)(angle / 0.08789); this.Name = keep.Name; this.Model = INVISIBLE_MODEL; this.Skin = component.Skin; m_oldMaxHealth = MaxHealth; this.Health = MaxHealth; // this.Health = component.Health; this.m_oldHealthPercent = this.HealthPercent; this.CurrentRegion = myregion; this.ID = component.ID; this.SaveInDB = false; this.IsRaized = false; LoadPositions(); this.AddToWorld(); FillPositions(); this.RepairedHealth = this.MaxHealth; m_CreateInfo = component.CreateInfo; StartHealthRegeneration(); }
public virtual void RegisterKeep(int keepID, AbstractGameKeep keep) { m_keepList.Add(keepID, keep); log.Info("Registered Keep: " + keep.Name); }
public KeepEventArgs(AbstractGameKeep keep, eRealm realm) { this.m_keep = keep; this.m_realm = realm; }
/// <summary> /// Realm points a keep is worth when captured /// </summary> /// <param name="keep"></param> /// <returns></returns> public virtual int GetRealmPointsForKeep(AbstractGameKeep keep) { int value = 0; if (keep is GameKeep) { value = Math.Max(50, ServerProperties.Properties.KEEP_RP_BASE + ((keep.BaseLevel - 50) * ServerProperties.Properties.KEEP_RP_MULTIPLIER)); } else { value = Math.Max(5, ServerProperties.Properties.TOWER_RP_BASE + ((keep.BaseLevel - 50) * ServerProperties.Properties.TOWER_RP_MULTIPLIER)); } value += ((keep.Level - ServerProperties.Properties.STARTING_KEEP_LEVEL) * ServerProperties.Properties.UPGRADE_MULTIPLIER); return Math.Max(5, value); }
/// <summary> /// Sends a message to all players to notify them of the raize /// </summary> /// <param name="keep">The keep object</param> /// <param name="realm">The raizing realm</param> public static void BroadcastRaize(AbstractGameKeep keep, eRealm realm) { string message = string.Format(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "PlayerManager.BroadcastRaize.Razed", keep.Name, GlobalConstants.RealmToName(realm))); BroadcastMessage(message, eRealm.None); NewsMgr.CreateNews(message, keep.Realm, eNewsType.RvRGlobal, false); }
public virtual void SendKeepRealmUpdate(AbstractGameKeep keep) { }
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))); } }
/// <summary> /// Method to tell us if a player can interact with the lord to do certain tasks /// </summary> /// <param name="player">The player object</param> /// <param name="keep">The area object</param> /// <param name="type">The type of interaction</param> /// <returns></returns> public static bool IsAllowedToInteract(GamePlayer player, AbstractGameKeep keep, eInteractType type) { if (player.Client.Account.PrivLevel > 1) return true; if (player.Realm != keep.Realm) return false; if (player.Guild == null) return false; if (keep.InCombat) { log.DebugFormat("KEEPWARNING: {0} attempted to {1} {2} while in combat.", player.Name, type, keep.Name); return false; } switch (type) { case eInteractType.Claim: { if (keep.Guild != null) return false; foreach (AbstractGameKeep k in GameServer.KeepManager.GetAllKeeps()) { if (k.Guild == player.Guild) return false; } if (player.Group == null) return false; if (player.Group.Leader != player) return false; if (player.Group.MemberCount < ServerProperties.Properties.CLAIM_NUM) return false; if (!player.GuildRank.Claim) return false; break; } case eInteractType.Release: { if (keep.Guild == null) return false; if (keep.Guild != player.Guild) return false; if (!player.GuildRank.Claim) return false; break; } case eInteractType.ChangeLevel: { if (keep.Guild == null) return false; if (keep.Guild != player.Guild) return false; if (!player.GuildRank.Claim) return false; break; } } return true; }
public virtual void SendKeepComponentUpdate(AbstractGameKeep keep, bool LevelUp) { }
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))); } }
/// <summary> /// Creates a guard patrol position /// </summary> /// <param name="guardID">The guard ID</param> /// <param name="component">The component object</param> /// <param name="player">The player object</param> /// <returns>The position object</returns> public static DBKeepPosition CreatePatrolPosition(string guardID, GameKeepComponent component, GamePlayer player, AbstractGameKeep.eKeepType keepType) { DBKeepPosition pos = CreatePosition(guardID, component, player); pos.Height = 0; pos.ClassType = "DOL.GS.Keeps.Patrol"; pos.KeepType = (int)keepType; GameServer.Database.AddObject(pos); return pos; }
public KeepArea(AbstractGameKeep keep) : base(keep.Name, keep.X, keep.Y, 0, keep.IsPortalKeep ? PK_RADIUS : (keep is GameKeepTower ? TOWER_RADIUS : KEEP_RADIUS) ) { Keep = keep; }
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; }
/// <summary> /// Main checking method to see if a player is an enemy of the keep /// </summary> /// <param name="keep">The keep checking</param> /// <param name="target">The target player</param> /// <param name="checkGroup">Do we check the players group for a friend</param> /// <returns>true if the player is an enemy of the keep</returns> public virtual bool IsEnemy(AbstractGameKeep keep, GamePlayer target, bool checkGroup) { if (target.Client.Account.PrivLevel != 1) return false; switch (GameServer.Instance.Configuration.ServerType) { case eGameServerType.GST_Normal: { return keep.Realm != target.Realm; } case eGameServerType.GST_PvP: { if (keep.Guild == null) return ServerProperties.Properties.PVP_UNCLAIMED_KEEPS_ENEMY; //friendly player in group if (checkGroup && target.Group != null) { foreach (GamePlayer player in target.Group.GetPlayersInTheGroup()) { if (!IsEnemy(keep, target, false)) return false; } } //guild alliance if (keep.Guild != null && keep.Guild.alliance != null) { if (keep.Guild.alliance.Guilds.Contains(target.Guild)) return false; } return keep.Guild != target.Guild; } case eGameServerType.GST_PvE: { return !(target is GamePlayer); } } return true; }
public virtual void SendKeepClaim(AbstractGameKeep keep, byte flag) { }
/// <summary> /// Convinience method for checking if a player is an enemy of a keep /// This sets checkGroup to true in the main method /// </summary> /// <param name="keep">The keep checking</param> /// <param name="target">The target player</param> /// <returns>true if the player is an enemy of the keep</returns> public virtual bool IsEnemy(AbstractGameKeep keep, GamePlayer target) { return IsEnemy(keep, target, true); }
public virtual double GetExperienceCapForKeep(AbstractGameKeep keep) { return 1.0; }
public virtual void SendKeepRemove(AbstractGameKeep keep) { }
/// <summary> /// Experience a keep is worth when captured /// </summary> /// <param name="keep"></param> /// <returns></returns> public virtual long GetExperienceForKeep(AbstractGameKeep keep) { return 0; }
/// <summary> /// Sends a message to all players of a realm, to notify them of a release /// </summary> /// <param name="keep">The keep object</param> public static void BroadcastRelease(AbstractGameKeep keep) { BroadcastMessage(string.Format(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "PlayerManager.BroadcastRelease.LostControl", keep.Guild.Name, keep.Name)), (eRealm)keep.Realm); }
/// <summary> /// How much money does this keep reward when captured /// </summary> /// <param name="keep"></param> /// <returns></returns> public virtual long GetMoneyValueForKeep(AbstractGameKeep keep) { return 0; }
/// <summary> /// Bounty points a keep is worth when captured /// </summary> /// <param name="keep"></param> /// <returns></returns> public virtual int GetBountyPointsForKeep(AbstractGameKeep keep) { return 0; }
/// <summary> /// Constructs a new KeepEventArgs /// </summary> public KeepEventArgs(AbstractGameKeep keep) { this.m_keep = keep; }