From: <wel...@us...> - 2009-06-24 20:34:04
|
Revision: 3864 http://planeshift.svn.sourceforge.net/planeshift/?rev=3864&view=rev Author: weltall2 Date: 2009-06-24 20:32:37 +0000 (Wed, 24 Jun 2009) Log Message: ----------- Added bracer support with groups defined in db. $B will substituite the racename in bracer meshfacts name DB BUMP: 1222 NET BUMP: 0xA0 part 1 / 2 Modified Paths: -------------- trunk/src/client/charapp.cpp trunk/src/client/pscelclient.cpp trunk/src/client/pscelclient.h trunk/src/client/psclientchar.cpp trunk/src/common/net/messages.cpp trunk/src/common/net/messages.h trunk/src/server/bulkobjects/pscharacter.cpp trunk/src/server/bulkobjects/pscharacter.h trunk/src/server/bulkobjects/psraceinfo.cpp trunk/src/server/bulkobjects/psraceinfo.h trunk/src/server/database/mysql/race_info.sql trunk/src/server/database/mysql/upgrade_schema.sql trunk/src/server/psserver.cpp Modified: trunk/src/client/charapp.cpp =================================================================== --- trunk/src/client/charapp.cpp 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/client/charapp.cpp 2009-06-24 20:32:37 UTC (rev 3864) @@ -31,6 +31,8 @@ static const uint meshCount = 9; static const char* meshNames[meshCount] = { "Head", "Torso", "Hand", "Legs", "Foot", "Arm", "Eyes", "Hair", "Beard" }; +static const uint bracersSlotCount = 2; +static csString BracersSlots[bracersSlotCount] = { "rightarm", "leftarm" }; psCharAppearance::psCharAppearance(iObjectRegistry* objectReg) { @@ -284,6 +286,12 @@ csString helmGroup(helmNode->GetContentsValue()); if ( helmGroup.Length() == 0 ) helmGroup = baseMesh->GetFactory()->QueryObject()->GetName(); + + // Do the bracer check. + csRef<iDocumentNode> bracerNode = doc->GetRoot()->GetNode("equiplist")->GetNode("bracer"); + csString BracerGroup(bracerNode->GetContentsValue()); + if ( BracerGroup.Length() == 0 ) + BracerGroup = baseMesh->GetFactory()->QueryObject()->GetName(); csRef<iDocumentNodeIterator> equipIter = doc->GetRoot()->GetNode("equiplist")->GetNodes("equip"); @@ -298,6 +306,8 @@ //If the mesh has a $H it means it's an helm so search for replacement mesh.ReplaceAll("$H",helmGroup); + //If the mesh has a $H it means it's a bracer so search for replacement + mesh.ReplaceAll("$B",BracerGroup); Equip(slot, mesh, part, partMesh, texture); } @@ -314,6 +324,17 @@ ) { + //Bracers must be managed separately as we have two slots in cal3d but only one slot here + //To resolve the problem we call recursively this same function with the "corrected" slot names + //which are rightarm leftarm + + if (slotname == "bracers") + { + for(int position = 0; position < bracersSlotCount; position++) + Equip(BracersSlots[position], mesh, part, subMesh, texture); + return; + } + if ( slotname == "helm" ) { ShowHair(false); @@ -350,6 +371,16 @@ csString& subMesh, csString& texture) { + + //look Equip() for more informations on this: bracers must be managed separately + + if (slotname == "bracers") + { + for(int position = 0; position < bracersSlotCount; position++) + Dequip(BracersSlots[position], mesh, part, subMesh, texture); + return true; + } + if ( slotname == "helm" ) { ShowHair(true); Modified: trunk/src/client/pscelclient.cpp =================================================================== --- trunk/src/client/pscelclient.cpp 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/client/pscelclient.cpp 2009-06-24 20:32:37 UTC (rev 3864) @@ -1225,16 +1225,19 @@ return true; } - // Helm Mesh Check - // If there is helm specific item and we don't have any race yet, fall back to + // Helm/bracer Mesh Check + // If there is helm/bracer specific item and we don't have any race yet, fall back to // the stonebreaker model csString replacement("stonebm"); + csString BracerReplacement("stonebm"); if ( cel->GetMainPlayer() ) { replacement = cel->GetMainPlayer()->helmGroup; + BracerReplacement = cel->GetMainPlayer()->BracerGroup; } psString factoryName(factName); factoryName.ReplaceAllSubString("$H", replacement); + factoryName.ReplaceAllSubString("$B", BracerReplacement); factName = factoryName; // Set up callback. @@ -1308,6 +1311,7 @@ name = mesg.name; race = mesg.race; helmGroup = mesg.helmGroup; + BracerGroup = mesg.BracerGroup; type = mesg.type; masqueradeType = mesg.masqueradeType; guildName = mesg.guild; @@ -1340,6 +1344,9 @@ if ( helmGroup.Length() == 0 ) helmGroup = factName; + + if ( BracerGroup.Length() == 0 ) + BracerGroup = factName; Debug3(LOG_CELPERSIST, 0, "Actor %s(%s) Received", mesg.name.GetData(), ShowID(mesg.entityid)); Modified: trunk/src/client/pscelclient.h =================================================================== --- trunk/src/client/pscelclient.h 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/client/pscelclient.h 2009-06-24 20:32:37 UTC (rev 3864) @@ -492,6 +492,7 @@ csString race; csString helmGroup; + csString BracerGroup; csString equipment; csString traits; csVector3 vel, angularVelocity; Modified: trunk/src/client/psclientchar.cpp =================================================================== --- trunk/src/client/psclientchar.cpp 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/client/psclientchar.cpp 2009-06-24 20:32:37 UTC (rev 3864) @@ -419,6 +419,7 @@ //if the mesh has a $H it means it's an helm so search for replacement equip.mesh.ReplaceAll("$H",object->helmGroup); + equip.mesh.ReplaceAll("$B",object->BracerGroup); if ( equip.type == psEquipmentMessage::EQUIP ) { Modified: trunk/src/common/net/messages.cpp =================================================================== --- trunk/src/common/net/messages.cpp 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/common/net/messages.cpp 2009-06-24 20:32:37 UTC (rev 3864) @@ -4611,6 +4611,7 @@ const char* race, unsigned short int gender, const char* helmGroup, + const char* bracerGroup, csVector3 collTop, csVector3 collBottom, csVector3 collOffSet, const char* texParts, const char* equipmentParts, @@ -4648,6 +4649,7 @@ msg->Add( race ); msg->Add ( gender ); msg->Add( helmGroup ); + msg->Add(BracerGroup); msg->Add( collTop ); msg->Add( collBottom ); msg->Add( collOffSet ); @@ -4684,6 +4686,7 @@ race = csString ( me->GetStr() ); gender = me->GetInt16(); helmGroup = csString ( me->GetStr() ); + BracerGroup = csString ( me->GetStr() ); top = me->GetVector(); bottom = me->GetVector(); Modified: trunk/src/common/net/messages.h =================================================================== --- trunk/src/common/net/messages.h 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/common/net/messages.h 2009-06-24 20:32:37 UTC (rev 3864) @@ -43,7 +43,7 @@ // This holds the version number of the network code, remember to increase // this each time you do an update which breaks compatibility -#define PS_NETVERSION 0x009F +#define PS_NETVERSION 0x00A0 // Remember to bump the version in pscssetup.h, as well. @@ -3011,6 +3011,7 @@ const char* raceName, unsigned short int gender, const char* helmGroup, + const char* BracerGroup, csVector3 collTop, csVector3 collBottom, csVector3 collOffset, const char* texParts, const char* equipmentParts, @@ -3049,6 +3050,7 @@ csString race; unsigned short int gender; csString helmGroup; // Used for helm groupings. + csString BracerGroup; // Used for bracers groupings. csVector3 top, bottom, offset; csString texParts; csString equipment; Modified: trunk/src/server/bulkobjects/pscharacter.cpp =================================================================== --- trunk/src/server/bulkobjects/pscharacter.cpp 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/server/bulkobjects/pscharacter.cpp 2009-06-24 20:32:37 UTC (rev 3864) @@ -109,6 +109,7 @@ characterType = PSCHARACTER_TYPE_UNKNOWN; helmGroup.Clear(); + BracerGroup.Clear(); help_event_flags = 0; memset(advantage_bitfield,0,sizeof(advantage_bitfield)); accountid = 0; @@ -241,7 +242,7 @@ SetRaceInfo(raceinfo); //Assign the Helm Group - Result helmResult(db->Select("SELECT helm FROM race_info WHERE id=%d", raceid)); + Result helmResult(db->Select("SELECT helm, bracer FROM race_info WHERE id=%d", raceid)); if(csGetTicks() - start > 500) { @@ -251,6 +252,8 @@ psserver->GetLogCSV()->Write(CSV_STATUS, status); } helmGroup = helmResult[0]["helm"]; + + BracerGroup = helmResult[0]["bracer"]; SetDescription(row["description"]); @@ -530,6 +533,7 @@ SetRaceInfo(raceinfo); helmGroup = raceinfo->helmGroup; + BracerGroup = raceinfo->BracerGroup; if (!LoadTraits(pid)) { @@ -2030,7 +2034,7 @@ void psCharacter::MakeEquipmentString( csString& equipment ) { equipment = "<equiplist>"; - equipment.AppendFmt("<helm>%s</helm>", EscpXML(helmGroup).GetData()); + equipment.AppendFmt("<helm>%s</helm><bracer>%s</bracer>", EscpXML(helmGroup).GetData(), EscpXML(BracerGroup).GetData()); for (int i=0; i<PSCHARACTER_SLOT_BULK1; i++) { Modified: trunk/src/server/bulkobjects/pscharacter.h =================================================================== --- trunk/src/server/bulkobjects/pscharacter.h 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/server/bulkobjects/pscharacter.h 2009-06-24 20:32:37 UTC (rev 3864) @@ -867,6 +867,7 @@ void CalculateMaxStamina(); const char* GetHelmGroup() { return helmGroup.GetData(); } + const char* GetBracerGroup() { return BracerGroup.GetData(); } size_t GetAssignedGMEvents(psGMEventListMessage& gmevents, int clientnum); void AssignGMEvent(int id, bool playerIsGM); @@ -896,6 +897,8 @@ csString helmGroup; // Some races share helms so this tells which // group it's in. If empty assume in racial group. + csString BracerGroup; // Some races share bracers so this tells which + // group it's in. If empty assume in racial group. /* Whether or not the character is a banker */ bool banker; public: Modified: trunk/src/server/bulkobjects/psraceinfo.cpp =================================================================== --- trunk/src/server/bulkobjects/psraceinfo.cpp 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/server/bulkobjects/psraceinfo.cpp 2009-06-24 20:32:37 UTC (rev 3864) @@ -65,6 +65,7 @@ initialCP = row.GetUInt32("initial_cp"); race = row.GetUInt32("race"); helmGroup = row["helm"]; + BracerGroup = row["bracer"]; sex = row["sex"]; gender = CacheManager::GetSingleton().ConvertGenderString(row["sex"]); Modified: trunk/src/server/bulkobjects/psraceinfo.h =================================================================== --- trunk/src/server/bulkobjects/psraceinfo.h 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/server/bulkobjects/psraceinfo.h 2009-06-24 20:32:37 UTC (rev 3864) @@ -80,6 +80,7 @@ float GetBaseAttribute(PSITEMSTATS_STAT attrib); csString helmGroup; /// The name of the helm group race is in. + csString BracerGroup; /// The name of the helm group race is in. private: void SetBaseAttribute(PSITEMSTATS_STAT attrib, float val); Modified: trunk/src/server/database/mysql/race_info.sql =================================================================== --- trunk/src/server/database/mysql/race_info.sql 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/server/database/mysql/race_info.sql 2009-06-24 20:32:37 UTC (rev 3864) @@ -41,6 +41,7 @@ `base_mental_regen_walk` float NOT NULL default '0', `armor_id` int(10) unsigned default '0', `helm` varchar(20) default '', + `bracer` VARCHAR(20) COMMENT 'Stores a bracer group allowing to use the same bracer mesh for more than one race, just like for the helm column' default ''; `race` int(5) unsigned NOT NULL, PRIMARY KEY USING BTREE (`id`) ); Modified: trunk/src/server/database/mysql/upgrade_schema.sql =================================================================== --- trunk/src/server/database/mysql/upgrade_schema.sql 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/server/database/mysql/upgrade_schema.sql 2009-06-24 20:32:37 UTC (rev 3864) @@ -1220,6 +1220,10 @@ ADD COLUMN `comments` TEXT DEFAULT NULL COMMENT 'A comment left by the player on the event' AFTER `vote`; UPDATE `server_options` SET `option_value`='1221' WHERE `option_name`='db_version'; +#1222 - Stefano Angeleri - Added bracer support +ALTER TABLE `race_info` ADD COLUMN `bracer` VARCHAR(20) COMMENT 'Stores a bracer group allowing to use the same bracer mesh for more than one race, just like for the helm column' default '' AFTER `helm`; +UPDATE `server_options` SET `option_value`='1221' WHERE `option_name`='db_version'; + # Insert your upgrade before this line. Remember when you set a new db_version # to update the server_options.sql file and update psserver.cpp as well. # This to ensure that everything is working if you use the create_all.sql to Modified: trunk/src/server/psserver.cpp =================================================================== --- trunk/src/server/psserver.cpp 2009-06-24 05:33:08 UTC (rev 3863) +++ trunk/src/server/psserver.cpp 2009-06-24 20:32:37 UTC (rev 3864) @@ -89,7 +89,7 @@ #include "workmanager.h" // Remember to bump this in server_options.sql and add to upgrade_schema.sql! -#define DATABASE_VERSION_STR "1221" +#define DATABASE_VERSION_STR "1222" psCharacterLoader psServer::CharacterLoader; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |