From: <ken...@us...> - 2007-12-17 02:43:38
|
Revision: 462 http://planeshift.svn.sourceforge.net/planeshift/?rev=462&view=rev Author: kennygraunke Date: 2007-12-16 18:43:42 -0800 (Sun, 16 Dec 2007) Log Message: ----------- - Removed MB Crystal Hunt code. Modified Paths: -------------- trunk/docs/history.txt trunk/src/server/psserver.cpp trunk/src/server/psserver.h trunk/src/server/spawnmanager.cpp trunk/src/server/spawnmanager.h Modified: trunk/docs/history.txt =================================================================== --- trunk/docs/history.txt 2007-12-17 00:42:55 UTC (rev 461) +++ trunk/docs/history.txt 2007-12-17 02:43:42 UTC (rev 462) @@ -1,3 +1,6 @@ +*** 2007-12-17 by Kenny Graunke +- Removed MB Crystal Hunt code. + *** 2007-12-15 by Andrew Craig - Moved the start server time to the end of initialization. It was causing some strange problems when the event was queued too early. Modified: trunk/src/server/psserver.cpp =================================================================== --- trunk/src/server/psserver.cpp 2007-12-17 00:42:55 UTC (rev 461) +++ trunk/src/server/psserver.cpp 2007-12-17 02:43:42 UTC (rev 462) @@ -866,66 +866,6 @@ return true; } -#ifdef PS_EGGHUNT -bool psServer::GetHiddenCrystalSpawnLoc(csVector3& pos,csString& sector,csRandomGen *randomgen) -{ - int count = db->SelectSingleNumber("select count(*) from " - "hunt_locations"); - - if (count) - { - int rule_id = randomgen->Get(count)+1; - - Result result (db->Select("select x,y,z,sector " - " from hunt_locations " - " where id=%d ", rule_id)); - - if (!result.IsValid()) - { - database->SetLastError(database->GetLastSQLError()); - return false; - } - - if (result.Count() != 1) - { - database->SetLastError(database->GetLastSQLError()); - return false; - } - - pos.x = atof(result[0][0]); - pos.y = atof(result[0][1]); - pos.z = atof(result[0][2]); - sector = result[0][3]; - - csString escape; - db->Escape( escape, sector ); - int check = db->SelectSingleNumber("select count(*)" - " from objects " - " where locx=%1.2f " - " and locy=%1.2f " - " and locz=%1.2f " - " and sector='%s'", - pos.x,pos.y,pos.z,escape.GetData()); - - return (check)?false:true; // Skip this spawn if already here. - } - return false; -} - - -int psServer::CreateCrystalEntry(float x,float y,float z,const char *sector ) -{ - csString escape; - db->Escape( escape, sector ); - db->Command("INSERT INTO hunt_locations (x,y,z,sector)" - " VALUES (%1.2f, %1.2f, %1.2f, \"%s\" )", - x,y,z,escape.GetData()); - - int id = db->SelectSingleNumber("SELECT last_insert_id()" ); - return id; -} -#endif // Egg hunt - void psServer::UpdateDialog( const char* area, const char* trigger, const char* response, int num ) { Modified: trunk/src/server/psserver.h =================================================================== --- trunk/src/server/psserver.h 2007-12-17 00:42:55 UTC (rev 461) +++ trunk/src/server/psserver.h 2007-12-17 02:43:42 UTC (rev 462) @@ -475,40 +475,6 @@ */ iResultSet* GetAllTriggersInArea(csString data); - - /** Fills in the position and sector vector, and returns true if the spot chosen is NOT occupied yet. - * Will randomly return a single spawn location from - * the hunt locations table. If there is already an - * object that has been spawned at that location then - * it returns false. Otherwise it returns true. - * - * @param pos: [CHANGES] Is set to the location for a spawn point from the hunt locations table. - * @param sector: [CHANGES] Is set to the sector name for a spawn point from the hunt locations table. - * @param randomgen: Is a pointer to the random generator that this function can use. - * @return Returns true if the spot chosen is NOT occupied yet and false if the spot chosen is occupied. - */ -#ifdef PS_EGGHUNT - bool GetHiddenCrystalSpawnLoc(csVector3& pos,csString& sector,csRandomGen *randomgen); -#endif - - /** - * This method is to create a crystal entry in the database. - * A crystal entry is just an entry in the database that - * gives details on a game that was invented - * using the capabilities we have in MB, such as inventory - * and picking up items. This is in the form of an Easter - * Egg hunt (American style) called the Crystal Hunt. - * - * @param x: Is the x poisition to create a new crystal entry. - * @param y: Is the y poisition to create a new crystal entry. - * @param z: Is the z poisition to create a new crystal entry. - * @praam sector: Is the sector name we want the crystal entry to be in. - * @return Returns the hunt_location ID of this new crystal entry. - */ -#ifdef PS_EGGHUNT - int CreateCrystalEntry(float x,float y,float z,const char *sector ); -#endif - /** Return a list of NPCs (with their info) managed by a particular superclient. * * @param superclientID is the playerID of the superclient Modified: trunk/src/server/spawnmanager.cpp =================================================================== --- trunk/src/server/spawnmanager.cpp 2007-12-17 00:42:55 UTC (rev 461) +++ trunk/src/server/spawnmanager.cpp 2007-12-17 02:43:42 UTC (rev 462) @@ -173,11 +173,6 @@ PreloadDatabase(); -#ifdef PS_EGGHUNT - randomgen = psserver->rng; - QueueNextHiddenCrystalSpawn(); -#endif - psserver->GetEventManager()->Subscribe(this,MSGTYPE_LOOTITEM,REQUIRE_READY_CLIENT|REQUIRE_ALIVE); psserver->GetEventManager()->Subscribe(this,MSGTYPE_DEATH_EVENT,NO_VALIDATION); } @@ -777,37 +772,6 @@ return; } - -#ifdef PS_EGGHUNT - // Egghunt logic first - if (playerID < 0) - { - uint32 itemID = (uint32)-playerID; - if (itemID > (uint32) SPAWN_POINT_TAKEN) // SPAWN_POINT_TAKEN is special case to skip but still queue next - { - psItemStats *crystalstats=CacheManager::GetSingleton().GetBasicItemStatsByID(itemID); - if (crystalstats==NULL) - { - Error2("Could not find basic stats with ID %u for crystal spawn.\n",itemID); - } - else - { - psItem *crystalitem = crystalstats->InstantiateBasicItem(); - if (crystalitem!=NULL) - { - crystalitem->SetLocationInWorld(spawnsector,where.x, where.y, where.z, rot); - entitymanager->CreateItem(crystalitem,false); - - crystalitem->Loaded(); // Item is fully created - crystalitem->Save(); // First save - } - } - } - QueueNextHiddenCrystalSpawn(); - return; - } -#endif - psCharacter *chardata=psServer::CharacterLoader.LoadCharacterData(playerID,false); if (chardata==NULL) { @@ -821,62 +785,12 @@ chardata->ResetMode(); chardata->SetLocationInWorld(instance,spawnsector,where.x,where.y,where.z,rot); - // Now create the NPC as usual EntityManager::GetSingleton().CreateNPC(chardata); ServerStatus::mob_birthcount++; } -#ifdef PS_EGGHUNT -void SpawnManager::QueueNextHiddenCrystalSpawn() -{ - // Queue for respawn according to rules - SpawnRule key; - key.SetID(SPAWN_POINT_TAKEN); // hardcoded rule # for this - - SpawnRule *respawn = rules.Find(&key); - if (!respawn) - { - Notify1(LOG_SPAWN,"Respawn rule for Hidden Crystal, rule 999 was not found! No more eggs.\n"); - return; - } - - csVector3 pos; - float angle; - csString sector; - int delay = respawn->GetRespawnDelay(); - - angle = 2*3.14159*randomgen->Get(); - - uint32 itemID = (uint32)SPAWN_BASE_ITEM; - int rnd = randomgen->Get(100); - if (rnd>=90) - itemID++; - if (rnd>98) - itemID++; - - // special hack to skip the eggspawn but still requeue another one - if (!psserver->GetHiddenCrystalSpawnLoc(pos,sector,randomgen)) - itemID = (uint32)SPAWN_POINT_TAKEN; - - psSectorInfo *spawnsector = CacheManager::GetSingleton().GetSectorInfoByName(sector); - if (spawnsector==NULL) - { - Error2("QueueNextHiddenCrystalSpawn indicated unresolvable sector '%s'\n",(const char*)sector); - return; - } - - psSheduledItem* item = new psSheduledItem(itemID,pos,spawnsector,delay); - - // -itemID below is a hack to differentiate eggs from other spawns - psItemSpawnEvent *newevent = new psItemSpawnEvent(item); - psserver->GetEventManager()->Push(newevent); - - Notify3(LOG_SPAWN,"Scheduled hidden crystal %u to be spawned in %1.1f seconds.\n",itemID,(float)delay/1000.0); -} -#endif - void SpawnManager::HandleLootItem(MsgEntry *me,Client *client) { psLootItemMessage msg(me); Modified: trunk/src/server/spawnmanager.h =================================================================== --- trunk/src/server/spawnmanager.h 2007-12-17 00:42:55 UTC (rev 461) +++ trunk/src/server/spawnmanager.h 2007-12-17 02:43:42 UTC (rev 462) @@ -311,10 +311,6 @@ csHash<LootEntrySet*> looting; LootRandomizer *lootRandomizer; -#ifdef PS_EGGHUNT - csRandomGen *randomgen; -#endif - void HandleLootItem(MsgEntry *me,Client *client); void HandleDeathEvent(MsgEntry *me); @@ -400,15 +396,6 @@ * and queues him for respawn according to the spawn rules. */ void RemoveNPC(gemObject *obj); - -#ifdef PS_EGGHUNT - /** - * Special logic for respawning random Easter Eggs for the Crystal Hunt. - */ - void QueueNextHiddenCrystalSpawn(); -#endif - - }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |