/*
* DAWN OF LIGHT - The first free open source DAoC server emulator
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using DOL.Events;
using DOL.GS;
using DOL.GS.Effects;
using DOL.GS.Movement;
using DOL.GS.PacketHandler;
using DOL.GS.SkillHandler;
using DOL.GS.Keeps;
using DOL.Language;
using log4net;
namespace DOL.AI.Brain
{
public class GameObeliskBrain : StandardMobBrain
{
public List<GamePlayer> playersWarned = new List<GameLiving>();
public int attackTimerInterval = 3000;
public int attackDelayInterval = 30000;
protected Random m_random = new Random();
public GameObeliskBrain()
: base() {
m_aggroLevel = 0;
m_aggroMaxRange = 250;
}
public override int ThinkInterval {
get { return 3000; }
}
public override void Think() {
var currentPlayersSeen = new List<GamePlayer>();
foreach (GamePlayer player in Body.GetPlayersInRadius((ushort)AggroRange, true)) {
string obeliskWarning = "The air is thick with currents of elemental energy flowing from the nexus rift at the base of the Obelisk. ";
obeliskWarning += "This area is not safe to linger in.";
player.Out.SendMessage(obeliskWarning, eChatType.CT_Say, eChatLoc.CL_ChatWindow);
if (!playersWarned.Contains(player)) {
playersWarned.Add(player);
attackTimer = new RegionTimer(Body, new RegionTimerCallback(obeliskAttackTimerCallback), attackDelayInterval);
attackTimer.Properties.setProperty("gamePlayer",player);
}
currentPlayersSeen.Add(player);
for (int i=0; i<playersWarned.Count; i++)
{
if (!currentPlayersSeen.Contains(playersWarned[i])){
playersWarned.RemoveAt(i);
}
}
}
return;
}
public function obeliskAttackTimerCallback(RegionTimer callingTimer){
GamePlayer player = callingTimer.Properties.getProperty("gamePlayer");
if (player && playersWarned.Contains(player)){
int damage = m_random.Next(120,170);
string obeliskDamage = "Lightning strikes you from the ceiling! It flows into the nexus rift at the base of the Obelisk of Nurizane.";
obeliskDamage += "You should leave the area immediately if you wish to avoid further damage.";
string damageMessage = "The nexus rift lighting hits you for "+damage+" damage.";
player.Out.SendMessage(damageMessage, eChatType.CT_YouWereHit, eChatLoc.CL_ChatWindow);
player.ChangeHealth(player,ChangeHealth.Unknown,damage);
attackTimer = new RegionTimer(Body, new RegionTimerCallback(obeliskAttackTimerCallback), attackTimerInterval);
attackTimer.Properties.setProperty("gamePlayer",player);
}
}
}
}
/*
* DAWN OF LIGHT - The first free open source DAoC server emulator
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using DOL.Events;
using DOL.GS;
using DOL.GS.Effects;
using DOL.GS.Movement;
using DOL.GS.PacketHandler;
using DOL.GS.SkillHandler;
using DOL.GS.Keeps;
using DOL.Language;
using log4net;
namespace DOL.AI.Brain
{
public class GameObeliskBrain : StandardMobBrain
{
public List<GamePlayer> playersWarned = new List<GamePlayer>();
public int attackTimerInterval = 3000;
public int attackDelayInterval = 30000;
protected Random m_random = new Random();
public GameObeliskBrain()
: base() {
m_aggroLevel = 0;
m_aggroMaxRange = 250;
}
public override int ThinkInterval {
get { return 3000; }
}
public override void Think() {
var currentPlayersSeen = new List<GamePlayer>();
foreach (GamePlayer player in Body.GetPlayersInRadius((ushort)AggroRange, true)) {
string obeliskWarning = "The air is thick with currents of elemental energy flowing from the nexus rift at the base of the Obelisk. ";
obeliskWarning += "This area is not safe to linger in.";
player.Out.SendMessage(obeliskWarning, eChatType.CT_Say, eChatLoc.CL_ChatWindow);
if (!playersWarned.Contains(player)) {
playersWarned.Add(player);
RegionTimer attackTimer = new RegionTimer(Body, new RegionTimerCallback(obeliskAttackTimerCallback), attackDelayInterval);
attackTimer.Properties.setProperty("gamePlayer",player);
}
currentPlayersSeen.Add(player);
for (int i=0; i<playersWarned.Count; i++)
{
if (!currentPlayersSeen.Contains(playersWarned[i])){
playersWarned.RemoveAt(i);
}
}
}
return;
}
public virtual int obeliskAttackTimerCallback(RegionTimer callingTimer){
GamePlayer player = callingTimer.Properties.getProperty<object>("gamePlayer", null) as GamePlayer;
if (player != null && playersWarned.Contains(player)){
int damage = m_random.Next(120,170);
string obeliskDamage = "Lightning strikes you from the ceiling! It flows into the nexus rift at the base of the Obelisk of Nurizane.";
obeliskDamage += "You should leave the area immediately if you wish to avoid further damage.";
string damageMessage = "The nexus rift lighting hits you for "+damage+" damage.";
player.Out.SendMessage(damageMessage, eChatType.CT_YouWereHit, eChatLoc.CL_ChatWindow);
player.ChangeHealth(player,DOL.GS.GameLiving.eHealthChangeType.Unknown,damage);
RegionTimer attackTimer = new RegionTimer(Body, new RegionTimerCallback(obeliskAttackTimerCallback), attackTimerInterval);
attackTimer.Properties.setProperty("gamePlayer",player);
}
return 0;
}
}
}
Users browsing this forum: No registered users and 1 guest