From: tomtt <to...@us...> - 2007-01-31 21:37:06
|
Update of /cvsroot/planeshift/planeshift/src/server/bulkobjects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3799 Modified Files: psactionlocationinfo.cpp Log Message: Added support for entry progression scripts. Index: psactionlocationinfo.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/psactionlocationinfo.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** psactionlocationinfo.cpp 26 Dec 2006 19:41:50 -0000 1.30 --- psactionlocationinfo.cpp 31 Jan 2007 21:37:01 -0000 1.31 *************** *** 77,81 **** --- 77,85 ---- responsetype = ""; response = ""; + isContainer = false; isGameBoard = false; + isEntrance = false; + isLockable = false; + enterScript = ""; activeInd = LOCATION_ACTIVE; } *************** *** 368,371 **** --- 372,424 ---- } + void psActionLocation::SetInstanceID(uint32 newID) + { + if ( response.StartsWith( "<Examine>", false ) ) + { + // load response into XML doc + csRef<iDocument> doc = ParseString( response ); + if(!doc) + { + Error1("Parse error in action response"); + return; + } + + csRef<iDocumentNode> root = doc->GetRoot(); + if(!root) + { + Error1("No XML root in action response"); + return; + } + + csRef<iDocumentNode> topNode = root->GetNode( "Examine" ); + if(!topNode) + { + Error1("No <Examine> tag in action response"); + return; + } + + // Check for container IDs + csRef<iDocumentNode> containerNode, descriptionNode; + containerNode = topNode->GetNode( "Container" ); + if ( containerNode ) + { + containerNode->SetAttributeAsInt( "ID", (int)newID ); + response = GetNodeXML(topNode); + Save(); + return; + } + + // Check for item IDs + csRef<iDocumentNode> entranceNode; + entranceNode = topNode->GetNode( "Entrance" ); + if ( entranceNode ) + { + entranceNode->SetAttributeAsInt( "LockID", (int)newID ); + response = GetNodeXML(topNode); + Save(); + return; + } + } + } // Initialize Examine action Location *************** *** 393,402 **** // Send player to x=2,y=3.2,z=0.4,rot=35.0 in NPCroom2 using action ID instance after checking LockID is locked // <Examine> ! // <Entrance LockID=\'112\' Type=\'ActionID\' Sector=\'NPCroom2\' X=2.0 Y=3.2 Z=0.4 Rot=35.0/> // <Description>A lovely residence.</Description> // </Examine> ! // Exit example: // <Examine> ! // <Entrance Type=\'Exit\' Sector=\'NPCroom\' X=56.0 Y=0.2 Z=110.4 Rot=215.0/> // <Description>A door out.</Description> // </Examine> --- 446,462 ---- // Send player to x=2,y=3.2,z=0.4,rot=35.0 in NPCroom2 using action ID instance after checking LockID is locked // <Examine> ! // <Entrance Type=\'ActionID\' LockID=\'112\' Sector=\'NPCroom2\' X=2.0 Y=3.2 Z=0.4 Rot=35.0/> // <Description>A lovely residence.</Description> // </Examine> ! // Action ID Entrance example with a scripted lock: ! // Send player to x=2,y=3.2,z=0.4,rot=35.0 in NPCroom2 using action ID instance after running EnterScript // <Examine> ! // <Entrance Type=\'Prime\' Script=\'EnterScript\' Sector=\'NPCroom2\' X=2.0 Y=3.2 Z=0.4 Rot=35.0/> ! // <Description>A new place to visit.</Description> ! // </Examine> ! // Exit example using no script and a more general Prime type ! // Send player back to x=56,y=0.2,z=110.4,rot=215.0 in NPCroom ! // <Examine> ! // <Entrance Type=\'Prime\' Sector=\'NPCroom\' X=56.0 Y=0.2 Z=110.4 Rot=215.0/> // <Description>A door out.</Description> // </Examine> *************** *** 447,451 **** { isEntrance = true; ! uint32 instance_id = (uint32)entranceNode->GetAttributeValueAsInt( "LockID" ); if ( instance_id != 0 ) --- 507,511 ---- { isEntrance = true; ! enterScript = entranceNode->GetAttributeValue( "Script" ); uint32 instance_id = (uint32)entranceNode->GetAttributeValueAsInt( "LockID" ); if ( instance_id != 0 ) |