/// <summary> /// claim the keep to a guild /// </summary> /// <param name="player">the player who have claim the keep</param> public virtual void Claim(GamePlayer player) { this.m_guild = player.Guild; if (ServerProperties.Properties.GUILDS_CLAIM_LIMIT > 1) { player.Guild.SendMessageToGuildMembers("Your guild has currently claimed " + player.Guild.ClaimedKeeps.Count + " keeps of a maximum of " + ServerProperties.Properties.GUILDS_CLAIM_LIMIT, eChatType.CT_Guild, eChatLoc.CL_ChatWindow); } ChangeLevel((byte)ServerProperties.Properties.STARTING_KEEP_CLAIM_LEVEL); PlayerMgr.BroadcastClaim(this); foreach (GameKeepGuard guard in Guards.Values) { guard.ChangeGuild(); } foreach (GameKeepBanner banner in Banners.Values) { banner.ChangeGuild(); } this.SaveIntoDatabase(); LoadFromDatabase(DBKeep); StartDeductionTimer(); GameEventMgr.Notify(KeepEvent.KeepClaimed, this, new KeepEventArgs(this)); }
public override bool WhisperReceive(GameLiving source, string str) { if (InCombat) { return(false); } if (Component == null) { return(false); } if (!base.WhisperReceive(source, str)) { return(false); } if (!(source is GamePlayer)) { return(false); } GamePlayer player = (GamePlayer)source; if (!GameServer.ServerRules.IsSameRealm(this, player, true) || !GameServer.ServerRules.IsAllowedToClaim(player, CurrentRegion)) { return(false); } byte flag = 0; switch (str) { case "Claim Keep": { if (PlayerMgr.IsAllowedToInteract(player, this.Component.AbstractKeep, eInteractType.Claim)) { player.Out.SendDialogBox(eDialogCode.KeepClaim, (ushort)player.ObjectID, 0, 0, 0, eDialogType.YesNo, false, "Do you wish to claim\n" + this.Component.AbstractKeep.Name + "?"); return(true); } break; } case "Release Keep": { if (PlayerMgr.IsAllowedToInteract(player, this.Component.AbstractKeep, eInteractType.Release)) { flag += 4; } break; } } if (flag > 0) { player.Out.SendKeepClaim(this.Component.AbstractKeep, flag); } return(true); }
/// <summary> /// released the keep of the guild /// </summary> public virtual void Release() { this.Guild.ClaimedKeeps.Remove(this); PlayerMgr.BroadcastRelease(this); this.m_guild = null; StopDeductionTimer(); StopChangeLevelTimer(); ChangeLevel((byte)ServerProperties.Properties.STARTING_KEEP_LEVEL); foreach (GameKeepGuard guard in Guards.Values) { guard.ChangeGuild(); } foreach (GameKeepBanner banner in Banners.Values) { banner.ChangeGuild(); } this.SaveIntoDatabase(); }
public override void Die(GameObject killer) { base.Die(killer); if (this.AbstractKeep is GameKeepTower && ServerProperties.Properties.CLIENT_VERSION_MIN >= (int)GameClient.eClientVersion.Version175) { if (IsRaized == false) { Notify(KeepEvent.TowerRaized, this.AbstractKeep, new KeepEventArgs(this.AbstractKeep, killer.Realm)); PlayerMgr.BroadcastRaize(this.AbstractKeep, killer.Realm); IsRaized = true; foreach (GameKeepGuard guard in this.AbstractKeep.Guards.Values) { guard.MoveTo(guard.CurrentRegionID, guard.X, guard.Y, this.AbstractKeep.Z, guard.Heading); guard.SpawnPoint.Z = this.AbstractKeep.Z; } } } foreach (GameClient client in WorldMgr.GetClientsOfRegion(this.CurrentRegionID)) { client.Out.SendKeepComponentDetailUpdate(this); } }
public override void Die(GameObject killer) { base.Die(killer); if (AbstractKeep is GameKeepTower) { if (IsRaized == false) { Notify(KeepEvent.TowerRaized, AbstractKeep, new KeepEventArgs(AbstractKeep, killer.Realm)); PlayerMgr.BroadcastRaize(AbstractKeep, killer.Realm); IsRaized = true; foreach (GameKeepGuard guard in AbstractKeep.Guards.Values) { guard.MoveTo(guard.CurrentRegionID, guard.X, guard.Y, AbstractKeep.Z, guard.Heading); guard.SpawnPoint.Z = AbstractKeep.Z; } } } foreach (GameClient client in WorldMgr.GetClientsOfRegion(CurrentRegionID)) { client.Out.SendKeepComponentDetailUpdate(this); } }
/// <summary> /// reset the realm when the lord have been killed /// </summary> /// <param name="realm"></param> public virtual void Reset(eRealm realm) { LastAttackedByEnemyTick = 0; StartCombatTick = 0; Realm = realm; PlayerMgr.BroadcastCapture(this); Level = (byte)ServerProperties.Properties.STARTING_KEEP_LEVEL; //if a guild holds the keep, we release it if (Guild != null) { Release(); } //we repair all keep components, but not if it is a tower and is raised foreach (GameKeepComponent component in this.KeepComponents) { if (!component.IsRaized) { component.Repair(component.MaxHealth - component.Health); } foreach (GameKeepHookPoint hp in component.KeepHookPoints.Values) { if (hp.Object != null) { hp.Object.Die(null); } } } //change realm foreach (GameClient client in WorldMgr.GetClientsOfRegion(this.CurrentRegion.ID)) { client.Out.SendKeepComponentUpdate(this, false); } //we reset all doors foreach (GameKeepDoor door in Doors.Values) { door.Reset(realm); } //we make sure all players are not in the air ResetPlayersOfKeep(); //we reset the guards foreach (GameKeepGuard guard in Guards.Values) { if (guard is GuardLord && guard.IsAlive) { this.TemplateManager.GetMethod("RefreshTemplate").Invoke(null, new object[] { guard }); } else if (guard is GuardLord == false) { guard.Die(guard); } } //we reset the banners foreach (GameKeepBanner banner in Banners.Values) { banner.ChangeRealm(); } //update guard level for every keep if (!IsPortalKeep && ServerProperties.Properties.USE_KEEP_BALANCING) { GameServer.KeepManager.UpdateBaseLevels(); } //update the counts of keeps for the bonuses if (ServerProperties.Properties.USE_LIVE_KEEP_BONUSES) { KeepBonusMgr.UpdateCounts(); } SaveIntoDatabase(); GameEventMgr.Notify(KeepEvent.KeepTaken, new KeepEventArgs(this)); }