Page 1 of 2
Gaheris Style New Frontiers. File request
PostPosted: Fri Nov 02, 2012 6:29 pm
by Bones
I am about to start on creating a Gaheris style pve keep set for my private server. Before i get started I thought i would ask if anyone has done this and if they are willing to share the files. It would save me alot of time and I would appreciate that.
Re: Gaheris Style New Frontiers. File request
PostPosted: Mon Nov 05, 2012 1:55 am
by Bones
Started on my project. I am starting with 1 keep at a time populating and doing pathing. I need some help with the respawn of the keep. After the keep lord dies 30 minutes later i want the keep to respawn all mobs inside and reset the doors. If there are players inside the keep radius, they should be transported to the nearest realm keep. I currently have no Idea where or how to start or look for code to do the respawn and player transport. Maybe a code from the teleporter that looks for each gameliving client within the area?
Re: Gaheris Style New Frontiers. File request
PostPosted: Thu Nov 08, 2012 12:41 am
by Valaquent
I have been working on some PvE keeps for a bit myself, and might be able to help a bit here. Mine is still a work in progress, but I can give some pointers, though I have largely been using modifications of the existing keep system.
The guard respawn rates are hardcoded, and are set up in Template Manager.cs . What I have done is set the Keep Lord to be on a random timer, much like the guards, though somewhat longer on average so that they spawn closer to the end of the respawning.
It would probably take a fair bit of coding to change them to all respawn at one time, though if you were to want to try the keep reset happens in AbstractGameKeep.cs , near the end, in #region Reset. I see that the doors appear to be handled there as well. I would think you would need to start a timer from the keep capture, then check back against that timer for each guard and door in the reigon, then at 30 mins reset and respawn each of them.
Re: Gaheris Style New Frontiers. File request
PostPosted: Thu Nov 08, 2012 5:13 am
by Bones
Nice tips thanks.
I did find the spawn timers in the cs files dol\GameServer\keeps\managers\template Manager.cs
- Code: Select all
private static void SetGuardRespawn(GameKeepGuard guard)
{
if (guard is FrontierHastener)
{
guard.RespawnInterval = 150000; // 15 minutes
}
else if (guard is GuardLord)
{
if (guard.Component != null)
{
guard.RespawnInterval = guard.Component.Keep.LordRespawnTime;
}
else
{
guard.RespawnInterval = 300000; // 30 minutes
}
I was able to set them to all be in a guild so i could give them an emblem and set their loot table to drop seals, 1 per guard and set the Lords to 15 25 40 sanguines per kill.
Found the clothing manager to make them look cool. And the individual setting for each class under guards folder to set agro range and maxdistance type stuff. The template manager also hold the models and some other usefull data.
I started playing around with the lord brain to give him more abilities, based off a file i found for BossBrain BossMob. Seems to be coming together nicely.
Region reset in abstractkeeps I will look there. I was thinking more along the lines of some bit of code in the lord brain, i.e.
upon summoning- check keep area for players, yes- teleport them to nearest player keep - respawn all mobs associated with this keep, heal and close doors-
Now all i need to do is learn how to do that.
Re: Gaheris Style New Frontiers. File request
PostPosted: Thu Nov 08, 2012 12:28 pm
by geshi
You could set the lord respawn to 30 minutes then add the following to Lord.cs AddToWorld method..
- Code: Select all
foreach (GamePlayer player in this.GetPlayersInRadius(5000)) // maybe set that lower.. or higher..
{
//get spawn at a local portal keep
foreach (AbstractGameKeep keep in KeepMgr.GetKeepsOfRegion(CurrentRegionID))
{
if (keep.IsPortalKeep && keep.Realm == Realm)
{
ushort region = keep.CurrentRegion.ID;
int X = keep.X;
int Y = keep.Y;
int Z = keep.Z;
player.MoveTo(region, X, Y, Z, 0);
//maybe add a message here to let the player know what happened ..
break;
}
}
}
under m_lastRealm = Realm;
Re: Gaheris Style New Frontiers. File request
PostPosted: Thu Nov 08, 2012 12:46 pm
by Tolakram
Here's some of the code I use for one of the PVE keeps in D2.
The door timer
- Code: Select all
public class StormRegionPvEDoorCloseTimer : GameTimer
{
private AbstractGameKeep m_keep;
public StormRegionPvEDoorCloseTimer(AbstractGameKeep keep, StormRegion i)
: base(i.TimeManager)
{
m_keep = keep;
}
protected override void OnTick()
{
foreach (GameKeepDoor door in m_keep.Doors.Values)
{
door.Reset(0);
}
Stop();
}
}
Keep code.
- Code: Select all
/// <summary>
/// A keep located in D2
/// </summary>
public class StormRegionGameKeep_D2 : StormRegionGameKeep
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private StormRegionPvEDoorCloseTimer m_doorTimer = null;
public override Type TemplateManager
{
get
{
return typeof(D2KeepTemplateMgr);
}
}
public const int KEEP_RESPAWN_TIME = 600000;
/// <summary>
/// Respawn time for the lord of this keep (milliseconds)
/// </summary>
public override int LordRespawnTime
{
get { return KEEP_RESPAWN_TIME + 60000; }
}
public override long ExperiencePointsValue()
{
return GameServer.ServerRules.GetExperienceForLiving(BaseLevel) * 10;
}
public override double ExceedXPCapAmount()
{
return 10.0;
}
public override int RealmPointsValue()
{
return base.RealmPointsValue();
}
public override int BountyPointsValue()
{
return 1;
}
public override void Load(DBKeep keep)
{
CurrentRegion = WorldMgr.GetRegion((ushort)keep.Region);
StormRegion_D2 d2Region = CurrentRegion as StormRegion_D2;
InitialiseTimers();
keep.Realm = 0;
BaseLevel = keep.BaseLevel;
LoadFromDatabase(keep);
GameEventMgr.AddHandler(CurrentRegion, RegionEvent.PlayerEnter, new DOLEventHandler(SendKeepInit));
KeepArea area = null;
//see if any keep areas for this keep have already been added via DBArea
foreach (AbstractArea a in CurrentRegion.GetAreasOfSpot(keep.X, keep.Y, keep.Z))
{
if (a is KeepArea && a.Description == keep.Name)
{
log.Debug("Found a DBArea entry for D2 " + keep.Name + " in region " + CurrentRegion.ID + ", loading that instead of creating a new one.");
area = a as KeepArea;
area.Keep = this;
break;
}
}
if (area == null)
{
area = new KeepArea(this);
area.CanBroadcast = true;
area.CheckLOS = true;
if (CurrentRegion.AddArea(area) == null)
{
log.Debug("StormRegion_D2: failed to add area to region " + CurrentRegion.Description);
}
else
{
log.DebugFormat("StormRegion_D2: Added keep area to region {0} at x{1}, y{2}, z{3}", CurrentRegion.ID, area.X, area.Y, area.Z);
}
}
area.Keep = this;
this.Area = area;
}
public override void Reset(eRealm realm)
{
StormRegion_D2 d2Region = CurrentRegion as StormRegion_D2;
if (d2Region == null)
{
base.Reset(realm);
return;
}
// always realm 0
realm = eRealm.None;
LastAttackedByEnemyTick = 0;
StartCombatTick = 0;
Realm = realm;
PlayerMgr.BroadcastCapture(this);
Level = (byte)4;
//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.HookPoints.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
if (Realm != eRealm.None)
{
foreach (GameKeepDoor door in Doors.Values)
{
door.Reset(realm);
}
}
else
{
StopTimers();
m_doorTimer = new StormRegionPvEDoorCloseTimer(this, d2Region);
m_doorTimer.Start(KEEP_RESPAWN_TIME);
}
//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 == false)
{
guard.Die(guard);
}
}
//we reset the banners
foreach (GameKeepBanner banner in Banners.Values)
{
banner.ChangeRealm();
}
GameEventMgr.Notify(KeepEvent.KeepTaken, new KeepEventArgs(this));
SetGuardLevels();
}
public void SetGuardLevels()
{
foreach (GameKeepGuard guard in Guards.Values)
{
SetGuardLevel(guard);
}
}
public override void SetGuardLevel(GameKeepGuard guard)
{
if (guard is FrontierHastener)
{
guard.Level = 1;
}
else
{
guard.Level = (byte)(GetBaseLevel(guard));
}
}
public override byte GetBaseLevel(GameKeepGuard guard)
{
if (guard.Component == null)
{
if (guard is GuardLord)
{
return 120;
}
else
{
return 85;
}
}
else
{
if (guard is GuardLord)
{
return (byte)(guard.Component.Keep.BaseLevel + 25);
}
else
{
return guard.Component.Keep.BaseLevel;
}
}
}
protected void StopTimers()
{
if (m_doorTimer != null)
{
m_doorTimer.Stop();
m_doorTimer = null;
}
}
}
You can't use this code exactly as is, since it's infected with all kinds of D2 specific code, but it will hopefully provide some ideas for how to do it.
Re: Gaheris Style New Frontiers. File request
PostPosted: Fri Nov 09, 2012 7:31 am
by Bones
This was not expected but kinda funny. I am doing my testing on Dun Ailinne. After I /mob kill the lord, he respawns in 30 seconds and ports me to his spawn location. Then he transports to the Druim Ligen point I wanted to go to. I have the Keeps DB set to Realm 0 and original realm 1 2 3 based on Caer Dun or faste. So if you are on a mid keep it sends you to svas or hibby keep to Ligen or Albion keep to Sauvage
- Code: Select all
public override bool AddToWorld()
{
if (base.AddToWorld())
{
m_lastRealm = eRealm.None;
foreach (GamePlayer player in this.GetPlayersInRadius(4000)) // maybe set that lower.. or higher..
{
//get spawn at a local border keep
foreach (AbstractGameKeep keep in GameServer.KeepManager.GetKeepsOfRegion(CurrentRegionID))
{
if (keep.OriginalRealm == eRealm.Albion)
{
//sauvage
X = 653811;
Y = 616998;
Z = 9560;
break;
}
if (keep.OriginalRealm == eRealm.Midgard)
{
//svas
X = 651460;
Y = 313758;
Z = 9432;
break;
}
if (keep.OriginalRealm == eRealm.Hibernia)
{
//ligen
X = 396519;
Y = 618017;
Z = 9838;
break;
}
player.MoveTo(163, X, Y, Z, 0);
player.Out.SendMessage("This area isn't currently secure and you are being transported to a safer location.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
}
return true;
}
return false;
}
Re: Gaheris Style New Frontiers. File request
PostPosted: Fri Nov 09, 2012 8:47 am
by Bones
Then i tried this.
- Code: Select all
public override bool AddToWorld()
{
if (base.AddToWorld())
{
m_lastRealm = eRealm.None;
foreach (GamePlayer player in this.GetPlayersInRadius(4000)) // maybe set that lower.. or higher..
{
//get spawn at a local border keep
foreach (AbstractGameKeep keep in GameServer.KeepManager.GetKeepsOfRegion(CurrentRegionID))
{
if (keep is GameKeep)
{
switch (keep.OriginalRealm)
{
case eRealm.Albion:
//sauvage
player.MoveTo(163, 31258, 59345, 9559, 229);
break;
case eRealm.Midgard:
//svas
player.MoveTo(163, 61494, 18804, 9420, 156);
break;
case eRealm.Hibernia:
//ligen
player.MoveTo(163, 36053, 60900, 9839, 226);
break;
}
player.Out.SendMessage("This area isn't currently secure and you are being transported to a safe location.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
}
}
}
return true;
}
return false;
}
Now it is not teleporting me but is saying the mesage like 42 times.
Time for bed. Will work more later.
Re: Gaheris Style New Frontiers. File request
PostPosted: Fri Nov 09, 2012 9:22 pm
by Bones
Final working version. Checks the players region before porting them. Works pretty well, but could probably be cleaner.
- Code: Select all
public override bool AddToWorld()
{
if (base.AddToWorld())
{
m_lastRealm = eRealm.None;
foreach (GamePlayer player in this.GetPlayersInRadius(4000)) // maybe set that lower.. or higher..
{
int currentZoneID = player.CurrentZone.ID;
// player.Out.SendMessage("Before checking Zone ID. " + currentZoneID , eChatType.CT_System, eChatLoc.CL_ChatWindow);
switch (currentZoneID)
{
case 167: // Odin's gate
player.MoveTo(163, 651611, 315012, 9432, 1934);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Uppland.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 168: // Jamtland Mountains
player.MoveTo(163, 651611, 315012, 9432, 1934);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Uppland.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 169: // Yggdra Forest
player.MoveTo(163, 651611, 315012, 9432, 1934);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Uppland.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 170: // Uppland
player.MoveTo(163, 651611, 315012, 9432, 1934);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Uppland.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 171: // Emain Macha
player.MoveTo(163, 395861, 618238, 9816, 2548);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Cruachan Gorge.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 172: // Breifine
player.MoveTo(163, 395861, 618238, 9816, 2548);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Cruachan Gorge.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 173: // Crauchan Gorge
player.MoveTo(163, 395861, 618238, 9816, 2548);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Cruachan Gorge.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 174: // Mount Collory
player.MoveTo(163, 395861, 618238, 9816, 2548);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Cruachan Gorge.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 175: // Snowdonia
player.MoveTo(163, 652700, 617189, 9560, 2815);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Forest Sauvage.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 176: // Forest Sauvage
player.MoveTo(163, 652700, 617189, 9560, 2815);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Forest Sauvage.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 177: // Pennine Mountains
player.MoveTo(163, 652700, 617189, 9560, 2815);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Forest Sauvage.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 178: // Hadrian's Wall
player.MoveTo(163, 652700, 617189, 9560, 2815);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Forest Sauvage.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
}
}
return true;
}
return false;
}
Now I need to work on getting the respawn of the keep and closing doors.
Re: Gaheris Style New Frontiers. File request
PostPosted: Fri Nov 09, 2012 11:48 pm
by Bones
Made some adjustments. If it is a Keep lord... port you to Main Frontiers region if you are within the keep. If it is a Tower Lord... Kick you out of the tower 2500 feet if you are within the tower
- Code: Select all
public override bool AddToWorld()
{
if (base.AddToWorld())
{
m_lastRealm = eRealm.None;
#region Keep Lord
// is this a Keep Lord
if (this.Component != null && this.Component.Keep != null && this.Component.Keep is GameKeep)
{
BroadcastUpdate();
Yell("Get out of my Keep.");
foreach (GamePlayer player in this.GetPlayersInRadius(4000)) // maybe set that lower.. or higher..
{
int currentZoneID = player.CurrentZone.ID;
// player.Out.SendMessage("Before checking Zone ID. " + currentZoneID , eChatType.CT_System, eChatLoc.CL_ChatWindow);
switch (currentZoneID)
{
case 167: // Odin's gate
player.MoveTo(163, 651611, 315012, 9432, 1934);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Uppland.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 168: // Jamtland Mountains
player.MoveTo(163, 651611, 315012, 9432, 1934);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Uppland.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 169: // Yggdra Forest
player.MoveTo(163, 651611, 315012, 9432, 1934);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Uppland.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 170: // Uppland
player.MoveTo(163, 651611, 315012, 9432, 1934);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Uppland.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 171: // Emain Macha
player.MoveTo(163, 395861, 618238, 9816, 2548);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Cruachan Gorge.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 172: // Breifine
player.MoveTo(163, 395861, 618238, 9816, 2548);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Cruachan Gorge.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 173: // Crauchan Gorge
player.MoveTo(163, 395861, 618238, 9816, 2548);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Cruachan Gorge.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 174: // Mount Collory
player.MoveTo(163, 395861, 618238, 9816, 2548);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Cruachan Gorge.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 175: // Snowdonia
player.MoveTo(163, 652700, 617189, 9560, 2815);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Forest Sauvage.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 176: // Forest Sauvage
player.MoveTo(163, 652700, 617189, 9560, 2815);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Forest Sauvage.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 177: // Pennine Mountains
player.MoveTo(163, 652700, 617189, 9560, 2815);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Forest Sauvage.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
case 178: // Hadrian's Wall
player.MoveTo(163, 652700, 617189, 9560, 2815);
player.Out.SendMessage("This area isn't currently secure and you are being transported to Forest Sauvage.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
break;
}
}
}
#endregion KeepLord
#region Tower Lord
// is this a Tower captain
if (this.Component != null && this.Component.Keep != null && this.Component.Keep is GameKeepTower)
{
foreach (GamePlayer player in this.GetPlayersInRadius(700)) // Just outside of tower radius
{
int newX = this.X + 2500;
int newY = this.Y + 2500;
int newZ = this.Z - 300;
BroadcastUpdate();
Yell("Get out of my Tower.");
// player.Out.SendMessage("Get out of my Tower.", eChatType.CT_System, eChatLoc.CL_ChatWindow);
player.MoveTo(163, newX, newY, newZ, 1934);
}
}
#endregion Tower Lord
return true;
}
return false;
}
Re: Gaheris Style New Frontiers. File request
PostPosted: Sat Nov 10, 2012 7:56 pm
by RGCheek
Hi Bones, I am considering setting up a server just for me and my friends and maybe a few others at a local gaming store all of whom are not really into TvT, RvR, PvP or whatever.
So I want it to be PvE with rps given for humanoid kills, a more plateaued progression on class abilities (instead of starting at 1/50th max ability advancing to full, you would start at 1/2 max ability and work to max), pull the item minimum level requirements, put the keeps and castles in the housing options and then allow placement of those houses in any zone that is not in water, random boss MOB spawns and roaming major creatures that would attack player owned keeps and castles.
So, in short, I would be willing to help out whatever I can. I have doen a little bit of Csharp, but all this would still require a lot of ramp up time and I can opnly put about ten hours a week into such a project.
Re: Gaheris Style New Frontiers. File request
PostPosted: Sat Nov 10, 2012 10:19 pm
by Bones
That a pretty decent idea for a server for you and your friends. I was thinking of trying my hand at a script of npc mobs that wander from keep to keep killing everything in sight, much like an alb zerg of old.
I am not the best person to assist with what your wanting to do as i am just starting. I'd happily share my DB and scripts i've worked on so far. 99% of which is from trolling through this site and importing EVERYTHING i could get my hands on. It would certainly save you many hours of work.
Re: Gaheris Style New Frontiers. File request
PostPosted: Mon Nov 12, 2012 6:42 pm
by Bones
I added a bit of code in the addtoworld section to handle resetting the doors.
- Code: Select all
//we reset tower door
foreach (GameKeepDoor door in this.GetDoorsInRadius(1000)) // 1000 for tower 4000 for keep
{
door.Reset(Realm);
}
IMHO it looks sound and compiles. "Is this a gamekeepdoor within my radius? reset it" But it does not actually function to heal the door and close it. Am I close? or still way off on getting these damn doors to close on lord spawn?
Re: Gaheris Style New Frontiers. File request
PostPosted: Mon Nov 12, 2012 7:01 pm
by Bones
I am currently working on only 1 door, until i get it right. Dun Ailline Spire. When i click the door it says the door does not exist in the database. Use /door show to add. I deleted ALL gamekeepdoors in keep positions to remove superfluous data. enabled /door show. Added the door. restarted the server. The door appears in keeppositions table and is now clickable. but still tells me the door is not in the database. I think that may be the issue, it is not properly adding my door? How do i add the door if not through /door show?
Re: Gaheris Style New Frontiers. File request
PostPosted: Tue Nov 13, 2012 12:45 am
by Bones
This bit of code in the AddtoWorld section is actually resetting the doors on the main keep as intended. But it is not resetting the Tower doors.
- Code: Select all
//we reset all keep doors
foreach (GameKeepDoor door in this.GetDoorsInRadius(4000))
{
door.Reset(Realm);
}
I have tried various GameKeepTower GameTowerDoor KeepTowerDoor but cant find anything that would differentiate between a keep door and a tower door.
Might it be easier to just reset the whole tower? or keep? Trying to find code to do that.