Update of /cvsroot/planeshift/planeshift/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14362/src/server Modified Files: cachemanager.cpp cachemanager.h entitymanager.cpp npcmanager.cpp npcmanager.h psserver.cpp Log Message: - Added new NPCRACELIST message from server to superclients to distribute race parameters from server to superclients. - Added racelist npc client command to dump the race list info structure. - Modified all npctype and script operations to allow for $walk and $run as input in vel attribute. E.g. if a wander operation should be executed at run speed use: <wander vel="$run" /> or set default for a npc type with <npctype vel="$walk">..</npctype> - Modified the MoveTest NPCs to use the new walk and run speeds. Index: cachemanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/cachemanager.cpp,v retrieving revision 1.229 retrieving revision 1.230 diff -C2 -d -r1.229 -r1.230 *** cachemanager.cpp 14 Aug 2007 05:39:55 -0000 1.229 --- cachemanager.cpp 29 Aug 2007 18:45:13 -0000 1.230 *************** *** 1494,1498 **** --- 1494,1501 ---- if (newraceinfo->Load(result[currentrow])) + { + newraceinfo->LoadBaseSpeeds(psserver->GetObjectReg()); raceinfolist.Push(newraceinfo); + } else { *************** *** 1504,1507 **** --- 1507,1514 ---- } + int CacheManager::GetRaceInfoCount() + { + return raceinfolist.GetSize(); + } psRaceInfo *CacheManager::GetRaceInfoByIndex(int idx) Index: cachemanager.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/cachemanager.h,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** cachemanager.h 23 Jun 2007 18:08:18 -0000 1.93 --- cachemanager.h 29 Aug 2007 18:45:13 -0000 1.94 *************** *** 141,144 **** --- 141,145 ---- // Races + int GetRaceInfoCount(); psRaceInfo *GetRaceInfoByIndex(int idx); psRaceInfo *GetRaceInfoByID(unsigned int id); Index: entitymanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/entitymanager.cpp,v retrieving revision 1.212 retrieving revision 1.213 diff -C2 -d -r1.212 -r1.213 *** entitymanager.cpp 26 Jul 2007 01:02:31 -0000 1.212 --- entitymanager.cpp 29 Aug 2007 18:45:13 -0000 1.213 *************** *** 712,716 **** PS_ID EntityManager::CreateNPC(psCharacter *chardata, int instance, csVector3 pos, iSector* sector, float yrot, bool updateProxList) { - csString filename; if (chardata==NULL) return false; --- 712,715 ---- *************** *** 724,730 **** } ! filename.Format("/planeshift/models/%s/%s.cal3d",raceinfo->mesh_name,raceinfo->mesh_name); ! ! gemNPC *actor = new gemNPC(chardata, raceinfo->mesh_name, filename, instance, sector, pos, yrot, 0, chardata->GetCharacterID()); --- 723,727 ---- } ! gemNPC *actor = new gemNPC(chardata, raceinfo->mesh_name, raceinfo->GetMeshFileName(), instance, sector, pos, yrot, 0, chardata->GetCharacterID()); *************** *** 1010,1015 **** psserver->npcmanager->SendNPCList(client); - - client->SetReady( true ); } else --- 1007,1010 ---- Index: npcmanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/npcmanager.cpp,v retrieving revision 1.175 retrieving revision 1.176 diff -C2 -d -r1.175 -r1.176 *** npcmanager.cpp 28 Aug 2007 18:15:10 -0000 1.175 --- npcmanager.cpp 29 Aug 2007 18:45:14 -0000 1.176 *************** *** 49,52 **** --- 49,53 ---- #include "util/mathscript.h" #include "bulkobjects/servervitals.h" + #include "bulkobjects/psraceinfo.h" #include "util/serverconsole.h" #include "util/command.h" *************** *** 76,80 **** public: int ownerID; // Character ID of the owner ! int petID; // Character ID of the pet bool isActive; gemActor *owner; --- 77,81 ---- public: int ownerID; // Character ID of the owner ! unsigned int petID; // Character ID of the pet bool isActive; gemActor *owner; *************** *** 187,191 **** { gemActor *pet = NULL; - int i = 0; if ( owner && isActive) --- 188,191 ---- *************** *** 196,200 **** CheckSession(); - bool done = false; size_t numPets = owner->GetClient()->GetNumPets(); // Check to make sure this pet is still summoned --- 196,199 ---- *************** *** 203,210 **** pet = owner->GetClient()->GetPet( i ); if ( pet && pet->GetCharacterData() && pet->GetCharacterData()->GetCharacterID() == petID ) break; else pet = NULL; ! }; if ( pet ) --- 202,213 ---- pet = owner->GetClient()->GetPet( i ); if ( pet && pet->GetCharacterData() && pet->GetCharacterData()->GetCharacterID() == petID ) + { break; + } else + { pet = NULL; ! } ! } if ( pet ) *************** *** 563,566 **** --- 566,571 ---- SendMapList(client); + SendRaces(client); + delete acctinfo; *************** *** 588,591 **** --- 593,621 ---- } + void NPCManager::SendMapList(Client *client) + { + psWorld *psworld = EntityManager::GetSingleton().GetWorld(); + + csString regions; + psworld->GetAllRegionNames(regions); + + psMapListMessage list(client->GetClientNum(),regions); + list.SendMessage(); + } + + void NPCManager::SendRaces(Client *client) + { + int count = CacheManager::GetSingleton().GetRaceInfoCount(); + + psNPCRaceListMessage newmsg(client->GetClientNum(),count); + for (int i=0;i < count; i++) + { + psRaceInfo * ri = CacheManager::GetSingleton().GetRaceInfoByIndex(i); + newmsg.AddRace(ri->name,ri->walkBaseSpeed,ri->runBaseSpeed, i == (count-1)); + } + newmsg.SendMessage(); + } + + void NPCManager::SendNPCList(Client *client) { *************** *** 603,606 **** --- 633,638 ---- { newmsg.SendMessage(); + + // NPC Client is now ready client->SetReady(true); } *************** *** 611,625 **** } - void NPCManager::SendMapList(Client *client) - { - psWorld *psworld = EntityManager::GetSingleton().GetWorld(); - - csString regions; - psworld->GetAllRegionNames(regions); - - psMapListMessage list(client->GetClientNum(),regions); - list.SendMessage(); - } - void NPCManager::HandleCommandList(MsgEntry *me) { --- 643,646 ---- *************** *** 636,640 **** int times[24] = {0}; ! char cmd = list.msg->GetInt8(); while (cmd != list.CMD_TERMINATOR && !list.msg->overrun) { --- 657,661 ---- int times[24] = {0}; ! int cmd = list.msg->GetInt8(); while (cmd != list.CMD_TERMINATOR && !list.msg->overrun) { *************** *** 1188,1192 **** psPETCommandMessage msg( me ); gemNPC *pet = NULL; - gemActor *familiar = NULL; psCharacter *chardata = NULL; csString firstName, lastName; --- 1209,1212 ---- *************** *** 1884,1888 **** // Loop through all Sessions BinaryRBIterator< PetOwnerSession > loop( &OwnerPetList ); - bool found = false; for ( po = loop.First(); po; po = ++loop ) // Increase Pet Time in Game by NPC_TICK_INTERVAL { --- 1904,1907 ---- Index: npcmanager.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/npcmanager.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** npcmanager.h 12 May 2007 19:46:42 -0000 1.46 --- npcmanager.h 29 Aug 2007 18:45:14 -0000 1.47 *************** *** 147,150 **** --- 147,153 ---- void SendMapList(Client *client); + /// Send the list of races for the superclient to load on startup. + void SendRaces(Client *client); + /// Handle network message with pet directives void HandlePetCommand( MsgEntry *me ); Index: psserver.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/psserver.cpp,v retrieving revision 1.259 retrieving revision 1.260 diff -C2 -d -r1.259 -r1.260 *** psserver.cpp 17 Aug 2007 07:21:39 -0000 1.259 --- psserver.cpp 29 Aug 2007 18:45:14 -0000 1.260 *************** *** 353,364 **** Debug1(LOG_STARTUP,0,"Started User Manager\n"); ! // Load emotes ! if(!usermanager->LoadEmotes("/planeshift/data/emotes.xml", vfs)) ! { ! CPrintf(CON_ERROR, "Could not load emotes from emotes.xml\n"); ! return false; ! } ! ! entitymanager = new EntityManager; if (!entitymanager->Initialize(object_reg, serverthread->GetConnections(), --- 353,364 ---- Debug1(LOG_STARTUP,0,"Started User Manager\n"); ! // Load emotes ! if(!usermanager->LoadEmotes("/planeshift/data/emotes.xml", vfs)) ! { ! CPrintf(CON_ERROR, "Could not load emotes from emotes.xml\n"); ! return false; ! } ! ! entitymanager = new EntityManager; if (!entitymanager->Initialize(object_reg, serverthread->GetConnections(), |