Postby Axeblood » Sun Feb 08, 2009 1:26 am
I'm trying to understand how this is intended to work. My programming skills are still at baby level, but I'm learning which is actually fun. So far I can use teleporters for everything except battlegrounds and housing. My guess is if I understand how either one works I'll be able to make both work.
Here is what I understand so far:
I can place a teleporter where I want in the world with these commands
/mob create DOL.GS.AlbionTeleporter (or whichever realm it is)
/mob realm 1 (again, match whichever realm it is 1,2,3)
These seem to be the only absolutely necessary things
So next I look in the class file for the teleporter I am using. The NPC is able to interact with players. When clicked, a string is displayed with world place names which can be selected. I modify this to my liking and compare these names to the entries in my database teleport table. They are all present except for battlegrounds. Spelling is all correct except for case which is ok because on select, ToLower makes them all lower case.
Now I look at the case statements which match these destination names in lower case. They are all there including "battlegrounds". So, my first clue is that either I need to add "battlegrounds" to the teleport table or it has to be a special case handled in some other way. I've noticed that for every location I want to display and select, the corresponding entry in my teleport table has to be there with correct spelling. When I make changes to this the effected location stops working, as I expect. Now, how should battlegrounds work? Obviously something must happen to select the correct BG destination based on player level and realm rank. A single entry in the teleport table would not suffice, but I fool with this anyway before giving up and reading some more.
Next I see that once the destination is picked it gets passed to another method named Teleport along with the player and destination information. Somehow, that gets matched to the coordinates of places in the teleport table. I decide I need to see how that works in order to figure out why battlegrounds fails and other places succeed.
I look in GameTeleporters.cs and find a section that handles this special case. There are not a lot of comments, but clearly I'm in the right place. First, it checks to make sure BG zones are open and PrivLevel is correct. I make a note that either of these could be a problem, but since I'm not sure how to check for either, I will just assume these are OK right now.
The real work seems to be done by KeepMgr.GetBGPK but before I go see how it works, I notice that once it determines a portalKeep for the player, it will derive the realm, region, and XYZ coords from there, finally teleporting to that spot. This is making sense!
Now I look in KeepManager.cs to see how the seemingly magical GetBGPK works. Here is where I come to a dead end. It looks like GetBGPK iterates through the keep table finding all keeps that are not Cathal, not a PK, and have min and max level values matching the player level and checking realm rank level is right. This part is ok. I was confused by the entire if starting at 278 but now I get it. However, now what? I don't see the glue from this point.
We have the CK keep ID and the player realm and Region ID, so it should be possible to now find the PK for the player realm in that region, but I don't see anyplace where the XYZ coordinates for the PK are found. There are Border Keep coordinates near the end of this class file, but nowhere do I see how the PK locations can be found. I was following along, but somewhere I came off the tracks. Can anyone help?
One thought I have is maybe I need to add every BGPK to my keep table. I am just guessing that this may be how the locations are found. I just have not been able to follow the code to that point yet so its a guess.
As always, thanks for the great work here. No matter what I'm having the most fun possible while learning to write code.