Code:
method HE_UsePrototypeForAccountRootNode( prototypeName references String ) as Boolean
prototypeName = "e_account_prototype"
return true
.
method HE_PreSessionStarted( theAccount as NodeRef )
Debug( "LoginProcess", "Using default HeroEngine HE_PreSessionStarted()." )
.
method HE_PostSessionStarted( theAccount as NodeRef )
Debug( "LoginProcess", "Using default HeroEngine HE_PostSessionStarted()." )
.
method HE_PreEnteredArea( theAccount as NodeRef )
Debug( "LoginProcess", "Using default HeroEngine HE_PreEnteredArea()." )
modern_oil_refinery_area_id as ID = 4611686018513387949
if GetAreaNumber() = modern_oil_refinery_area_id
var current_character_appearance = theAccount.GetMyVisibleCharacter()
glomclass( "_extendedeventobject", current_character_appearance )
where current_character_appearance is kindof _extendedEventObject
current_character_appearance._extendedEventLookup["_characterSpecification"] = current_character_appearance._characterSpecification
marshal current_character_appearance.geometry_list to current_character_appearance._extendedEventLookup["geometry_list"]
.
current_character_appearance._characterSpecification = "Supervisor"
clear current_character_appearance.geometry_list
geometry_pair as Class geometry_pair
geometry_pair.geometry_part_string = "hard hat"
geometry_pair.geometry_slot_string = "headwear"
add back geometry_pair to current_character_appearance.geometry_list
geometry_pair.geometry_part_string = "the supervisor"
geometry_pair.geometry_slot_string = "personel"
add back geometry_pair to current_character_appearance.geometry_list
.
.
method HE_PostEnteredArea( theAccount as NodeRef )
Debug( "LoginProcess", "Using default HeroEngine HE_PostEnteredArea()." )
area as NodeRef of Class AreaRoot = GetRootNode()
// Give individual areas the opportunity to do things.
if HasMethod( area, "HE_AreaSpecificEnteredArea" )
if area.HE_AreaSpecificEnteredArea( theAccount )
// Call returned true, so the area overrode the below functionality.
return
.
.
// initialize the player
var entity = theAccount.GetMyChar()
if( entity != None )
entity.InitCommonCharacter()
.
// Position the character in the area
DoPositioning( theAccount )
.
method HE_PreClientReady( theAccount as NodeRef )
Debug( "LoginProcess", " HE_PreClientReady()." )
.
method HE_PostClientReady( theAccount as NodeRef )
Debug( "LoginProcess", "HeroEngine HE_PostClientReady()." )
PlayerLoadFinished( theAccount )
.
method HE_PreCharacterActivated( theAccount as NodeRef )
Debug( "LoginProcess", "UHeroEngine HE_PreCharacterActivated()." )
.
method HE_PostCharacterActivated( theAccount as NodeRef )
Debug( "LoginProcess", "HeroEngine HE_PostCharacterActivated()." )
account as NodeRef of Class _PlayerAccount = theAccount
area as NodeRef of Class AreaRoot = GetRootNode()
// Find the character.
// Don't validate that the pc node exists until after area-specific overrides get a chance to do validation/creation/whatever.
// This is important because it is the character selection area script's responsibility to create an initial PC.
pc as NodeRef of Class _PlayerCharacter = account.GetMyChar()
if pc = None
Debug( "LoginProcess", "No PC node for " + account.account_name + "." )
else
Debug( "LoginProcess", "Found PC node " + pc + " for " + account.account_name + "." )
.
// if this is a new session, move this character to the top of the account's character list
where account is kindof _SessionStarting
if ( pc != None )
if pc.name != ""
add front pc.name to account._charList
if account._charList.length > 1
loop i from 2 to account._charList.length
if account._charList[i] = pc.name
remove account._charList at i
.
.
.
.
.
.
// Allow for area-specific overrides of below functionality
if HasMethod( area, "HE_AreaSpecificCharacterActivated" )
Debug( "LoginProcess", "Calling override for AreaSpecificCharacterActivated() in " + GetAreaName( GetAreaNumber() ) + " for " + theAccount + " (" + account.account_name + ")." )
if area.HE_AreaSpecificCharacterActivated( account )
// returned true so it wants to override the remaining functionality
return
.
.
if getAreaNumber() = 1
// if we are in the holding area, we stop here because they do not yet have a character
return
.
// Validate existence of expected nodes
assert( pc != None, account.account_name + " got to _CharacterActivate() without a character_class node.")
vc as NodeRef of Class _characterAppearance = pc.GetMyVisibleCharacter()
assert( vc != None, account.account_name + " got to _CharacterActivate() without a visible_character node.")
// deal with the character's rendering
// vc.draw_character = true
exclude as List of ID
add back pc to exclude
if(pc.name != "")
$CHAT.ChatExcludeList(exclude, "", " * " + pc.name + " has entered the area.")
else
$CHAT.ChatExcludeList(exclude, "", " * Account " + account.account_name + " has entered the area.")
.
$CHAT.ChatPlayer( theAccount, "", "You have entered " + GetAreaName( GetAreaNumber() ) + " [area #" + GetAreaNumber() + " instance#" + GetInstanceNumber() + "].")
CallScript(GMNotesSystem, "SafeUpdatePopulateGMNotesList", account)
CallMethod( $STATES, "_SafeOnLogonDoInitialization", account )
.
method HE_PreAreaMoveFailed( theAccount as NodeRef )
Debug( "LoginProcess", " HE_PreAreaMoveFailed()." )
.
method HE_PostAreaMoveFailed( theAccount as NodeRef )
Debug( "LoginProcess", "HE_PostAreaMoveFailed()." )
account as NodeRef of Class _PlayerAccount
$CHAT.ChatPlayer( theAccount, "", "Unable able to move you to the new area." )
where account is kindof _AreaDetails
$CHAT.ChatWorld( "", "Unable to move " + account.account_name + " to area " + account.AreaID + "(" + account.AreaInstanceNumber + "). Reason: " + account._message )
.
.
method HE_PreExitingArea( theAccount as NodeRef )
Debug( "LogoffProcess", " HE_PreExitingArea()." )
modern_oil_refinery_area_id as ID = 4611686018513387949
if GetAreaNumber() = modern_oil_refinery_area_id
var current_character_appearance = theAccount.GetMyVisibleCharacter()
where current_character_appearance is kindof _extendedEventObject
current_character_appearance._characterSpecification = current_character_appearance._extendedEventLookup["_characterSpecification"]
unmarshal current_character_appearance.geometry_list from current_character_appearance._extendedEventLookup["geometry_list"]
.
RemoveClassFromNode( "_extendedEventObject", current_character_appearance )
.
.
method HE_PostExitingArea( " HeroEngine HE_PostExitingArea()." )
account as NodeRef of Class _PlayerAccount = theAccount
pc as NodeRef of Class _PlayerCharacter = account.GetMyChar()
// clean up possession and other char specific behaviors
if (pc != None)
if ( pc != account.GetControlledChar() )
// means player is currently possessing an npc
npc as NodeRef = account.GetControlledChar()
Debug( "LogoffProcess", pc + " attempting to UnpossessNPC " + npc )
else
Debug( "LogoffProcess", pc + " logging off no possession." )
.
else
$Debug.SendNotifyDebugMessage("LogoffProcess", "pc was none?")
.
// Allow for area-specific overrides of below functionality
if HasMethod( $ACCOUNT, "HE_AreaSpecificExitingArea" )
Debug( "LogoffProcess", "Calling override for HEAreaSpecificExitingArea() in " + GetAreaName( GetAreaNumber() ) + " for " + account + " (" + account.account_name + ")." )
$ACCOUNT.HE_AreaSpecificExitingArea( account )
return
.
if pc != None
if GetAreaNumber() != 1
$CHAT.ChatArea( "", " * " + pc.name + " has left the area." )
$CHAT.ChatWorld("logon", "* " + pc.name + " has exited the world.")
.
.
.
method HE_PreSessionEnding( theAccount as NodeRef )
Debug( "LoginProcess", "HE_PreSessionEnding()." )
.
method HE_PostSessionEnding( theAccount as NodeRef )
Debug( "LoginProcess", " HE_PostSessionEnding()." )
.
function DoPositioning( account as NodeRef of Class _PlayerAccount )
// Can't position a character that doesn't have a character_class or a visible_character.
pc as NodeRef of Class _PlayerCharacter = account.GetMyChar()
if (pc == None)
return
.
vc as NodeRef of Class _characterAppearance = pc.GetMyVisibleCharacter()
if ( vc == None )
return
.
name as String
if pc.name != ""
name = "Character '" + pc.name + "'"
else
name = "Account '" + account.account_name + "'"
.
// Set the pc's new area and instance.
if GetAreaNumber() != 1
pc._currentArea = GetAreaNumber()
pc._currentAreaInstance = GetInstanceNumber()
.
pos as Vector3
rot as Vector3
where account
is kindof _SessionStarting
if GetAreaNumber() != $CLEANTESTAREA._getCleanTestArea()
Debug( "LoginProcess", pc.name + " is logging into the game as an existing character. Using last known position " + vc.character_position + ", and rotation " + vc.character_rotation + "." )
account._TeleportPlayer( vc.character_position, vc.character_rotation )
else
account._TeleportPlayer( pos, rot )
.
return
.
default
connection as NodeRef of Class _PlayerConnection = GetPlayerConnectionNode( account )
where connection
is kindof _TravelTarget
targetAccount as NodeRef of Class _PlayerAccount = FindPlayerByName( connection._travelTargetCharacter )
if targetAccount == None
goto notarget
.
targetPC as NodeRef of Class _PlayerCharacter = targetAccount.GetMyChar()
RemoveClassFromNode( "_TravelTarget", connection )
if targetPC != None
account._TeleportPlayer( targetPC.GetPosition(), targetPC.GetRotation() )
else
goto notarget
.
.
default
label notarget
path as NodeRef of Class PathNode = PathUtils:GetPathByName( "Arrival" )
if path != None
pos = GetPositionOnPath( path )
Debug( "LoginProcess", name + " is moving between areas and I found an Arrival path (" + path + "). Teleporting to " + pos + "." )
account._TeleportPlayer( pos, rot )
else
Debug ( "LoginProcess", "No Arrival path found or target for " + name + " in area '" + GetAreaName( GetAreaNumber() ) + "', so positioning at origin." )
account._TeleportPlayer( pos, rot )
.
.
.
.
.
.
method HE_OnPlayerConnectionDisconnect( connection as NodeRef ) as Boolean
// Used by $ACCOUNT
// Parameters:
// connection - reference to the _playerConnection node
// Returns:
// handled - boolean indicating whether or not the clean engine processing should be used
//
// don't do reconnection mechanics
return true
.
function GetPositionOnPath( path as NodeRef of Class PathNode ) as Vector3
if path == None
return "(0,0,0)"
.
area as NodeRef of Class _Area = $AREA
if not ( area is kindof ArrivalPointData )
GlomClass( "ArrivalPointData", area )
.
where area is kindof ArrivalPointData
waypoint as NodeRef of Class PathPointNode = PathUtils:GetNextWaypoint( path, area.lastWaypoint )
if waypoint != None
area.lastWaypoint = waypoint
return waypoint.PathPointLocation
else
waypoint = PathUtils:GetFirstWaypoint( path )
if waypoint != None
area.lastWaypoint = waypoint
return waypoint.PathPointLocation
else
return "(0,0,0)"
.
.
.
.
function Debug( system as String, message as String )
if $CONFIGURATIONS._CoreScriptDebug( system )
$Debug.SendNotifyDebugMessage( system, message )
.
.