From: <ma...@us...> - 2007-12-21 16:34:44
|
Revision: 485 http://planeshift.svn.sourceforge.net/planeshift/?rev=485&view=rev Author: magodra Date: 2007-12-21 08:34:43 -0800 (Fri, 21 Dec 2007) Log Message: ----------- - Added test on item_category to verify correct value before loading item stats. Modified Paths: -------------- trunk/docs/history.txt trunk/src/npcclient/npcbehave.cpp trunk/src/server/bulkobjects/psitemstats.cpp trunk/src/server/database/mysql/item_stats.sql trunk/src/server/psserverchar.cpp Modified: trunk/docs/history.txt =================================================================== --- trunk/docs/history.txt 2007-12-21 11:27:23 UTC (rev 484) +++ trunk/docs/history.txt 2007-12-21 16:34:43 UTC (rev 485) @@ -1,4 +1,6 @@ *** 2007-12-21 by Anders Reggestad +- Added test on item_category to verify correct value before loading + item stats. - Some cleanups in the pet code. Added missing reactions to pet commands in the sample behavior.xml file. - Fixed setlog to accept t,y,1 instead of only "true", changed Modified: trunk/src/npcclient/npcbehave.cpp =================================================================== --- trunk/src/npcclient/npcbehave.cpp 2007-12-21 11:27:23 UTC (rev 484) +++ trunk/src/npcclient/npcbehave.cpp 2007-12-21 16:34:43 UTC (rev 485) @@ -2563,10 +2563,8 @@ csString typestr = node->GetAttributeValue("type"); if (typestr == "nearest") type = NEAREST; - else if (typestr == "boss") + else if (typestr == "boss" || typestr== "owner") type = OWNER; - else if (typestr == "owner") - type = OWNER; else if (typestr == "target") type = TARGET; else Modified: trunk/src/server/bulkobjects/psitemstats.cpp =================================================================== --- trunk/src/server/bulkobjects/psitemstats.cpp 2007-12-21 11:27:23 UTC (rev 484) +++ trunk/src/server/bulkobjects/psitemstats.cpp 2007-12-21 16:34:43 UTC (rev 485) @@ -415,7 +415,15 @@ SetImageName(CacheManager::GetSingleton().FindCommonString(row.GetUInt32("cstr_id_gfx_icon"))); SetPartMeshName(CacheManager::GetSingleton().FindCommonString(row.GetUInt32("cstr_id_part_mesh"))); SetPrice(row.GetInt("base_sale_price")); - SetCategory(CacheManager::GetSingleton().GetItemCategoryByID(row.GetInt("category_id"))); + int categoryId = row.GetInt("category_id"); + psItemCategory * category = CacheManager::GetSingleton().GetItemCategoryByID(categoryId); + if (!category) + { + // Should not load without a category. + Error3("None exsisting item category '%d' for itemstat '%d'",categoryId,uid); + return false; + } + SetCategory(category); reqs[0].name = row["requirement_1_name"]; reqs[0].min_value = row.GetFloat("requirement_1_value"); Modified: trunk/src/server/database/mysql/item_stats.sql =================================================================== --- trunk/src/server/database/mysql/item_stats.sql 2007-12-21 11:27:23 UTC (rev 484) +++ trunk/src/server/database/mysql/item_stats.sql 2007-12-21 16:34:43 UTC (rev 485) @@ -87,7 +87,7 @@ # Dumping data for table item_stats # -INSERT INTO `item_stats` VALUES (1,'B','Fist',0.00,100.00,0,0,'LEFTHAND RIGHTHAND','MELEEWEAPON',0.10,4,-1,-1,'0','0','0',0.00,0.00,0.00,0.00,1.00,0.00,2.10,1.00,0.20,0.20,0.20,0.00,0,0,0,0,0,'Hammer',0,0.00,'HAMMER','',0.00,'',0.00,'0',0.00,0,0,0.0000,0,0,0,1,'0','nosound',50,'','',NULL,NULL); +INSERT INTO `item_stats` VALUES (1,'B','Fist',0.00,100.00,0,0,'LEFTHAND RIGHTHAND','MELEEWEAPON',0.10,4,-1,-1,'0','0','0',0.00,0.00,0.00,0.00,1.00,0.00,2.10,1.00,0.20,0.20,0.20,0.00,0,0,0,0,0,'Hammer',1,0.00,'HAMMER','',0.00,'',0.00,'0',0.00,0,0,0.0000,0,0,0,1,'0','nosound',50,'','',NULL,NULL); INSERT INTO `item_stats` VALUES (2,'B','Small Battle Axe',5.00,5.00,100,0,'BULK LEFTHAND RIGHTHAND','MELEEWEAPON',0.10,2,-1,-1,'0','0','0',0.00,0.00,0.00,5.00,0.00,0.00,4.00,2.00,0.20,0.20,0.20,0.00,28,29,0,0,0,'Axe',1,350.00,'AXE','',0.00,'',0.00,'0',0.00,0,0,0.0000,0,0,0,1,'0','smallaxe',50,'','',NULL,NULL); INSERT INTO `item_stats` VALUES (3,'B','Battle Axe',10.00,5.00,150,0,'BULK LEFTHAND RIGHTHAND','MELEEWEAPON',0.10,2,-1,-1,'0','0','0',0.00,0.00,0.00,5.00,0.00,0.00,4.00,2.00,0.20,0.20,0.20,0.00,30,31,0,0,0,'Axe',1,650.00,'AXE','',0.00,'',0.00,'0',0.00,0,0,0.0000,0,0,0,1,'0','nosound',50,'','',NULL,NULL); INSERT INTO `item_stats` VALUES (4,'B','Broad Sword',7.00,5.00,100,0,'BULK LEFTHAND RIGHTHAND','MELEEWEAPON',0.10,0,-1,-1,'0','0','0',0.00,0.00,0.00,6.00,0.00,0.00,4.00,2.00,0.20,0.20,0.20,0.00,32,33,0,0,0,'Sabre',1,150.00,'SWORD','',0.00,'',0.00,'0',0.00,0,0,0.0000,0,0,0,1,'0','nosound',50,'','',NULL,NULL); @@ -228,7 +228,7 @@ INSERT INTO `item_stats` VALUES (234,'B','Book Container',1.00,100.00,1,20,'BULK','CONTAINER',0.10,-1,-1,-1,'0','0','0',0.00,0.00,0.00,0.00,1.00,0.00,2.10,1.00,0.20,0.20,0.20,0.00,131,151,0,0,0,'0',3,4.00,'GENERIC','',0.00,'',0.00,'',0.00,0,0,0.0000,0,0,0,1,'A Book Container','nosound',50,'','',NULL,NULL); INSERT INTO `item_stats` VALUES (235,'B','Sack',1.00,100.00,1,20,'BULK','CONTAINER',0.10,-1,-1,-1,'0','0','0',0.00,0.00,0.00,0.00,1.00,0.00,2.10,1.00,0.20,0.20,0.20,0.00,131,151,0,0,0,'0',3,4.00,'GENERIC','',0.00,'',0.00,'',0.00,0,0,0.0000,0,0,0,1,'A Sack','nosound',50,'','',NULL,NULL); INSERT INTO `item_stats` VALUES (319,'B','Iron Stock',3.00,100.00,5,0,'BULK LEFTHAND RIGHTHAND','STACKABLE',0.10,4,-1,-1,'0','0','0',0.00,0.00,0.00,0.00,1.00,0.00,2.10,1.00,0.20,0.20,0.20,0.00,131,151,0,0,0,'0',16,10.00,'','',0.00,'',0.00,'',0.00,0,0,0.0000,0,0,0,1,'Long metal bars of iron used in smiting.','nosound',50,'','',NULL,NULL); -INSERT INTO `item_stats` VALUES (408,'B','basecloths',1.00,100.00,1,0,'ARMS BOOTS GLOVES HEAD TORSO LEGS','ARMOR',0.10,7,-1,-1,'0','0','0',0.00,0.00,0.00,1.00,1.00,1.00,1.00,0.00,0.00,0.00,0.00,0.00,0,0,0,0,0,'0',0,0.00,'ARMOR','',0.00,'',0.00,'',0.00,0,0,0.0000,0,0,0,1,'Clothes used in combat when no other armor is available','nosound',50,'','',NULL,NULL); +INSERT INTO `item_stats` VALUES (408,'B','basecloths',1.00,100.00,1,0,'ARMS BOOTS GLOVES HEAD TORSO LEGS','ARMOR',0.10,7,-1,-1,'0','0','0',0.00,0.00,0.00,1.00,1.00,1.00,1.00,0.00,0.00,0.00,0.00,0.00,0,0,0,0,0,'0',2,0.00,'ARMOR','',0.00,'',0.00,'',0.00,0,0,0.0000,0,0,0,1,'Clothes used in combat when no other armor is available','nosound',50,'','',NULL,NULL); INSERT INTO `item_stats` VALUES (409,'B','Long Bow',2.00,100.00,1,5,'BULK RIGHTHAND LEFTHAND','RANGEWEAPON USESAMMO',0.10,6,-1,-1,'0','0','0',0.00,0.00,0.00,0.00,0.00,9.00,2.00,7.00,0.00,0.00,0.00,0.00,28,29,29,0,0,'Stick',1,25.00,'BOW','',0.00,'',0.00,'',0.00,410,0,0.0000,0,0,0,0,'A long bow of normal quality. Common among rangers and is reputed for its long range.','nosound',50,'','',NULL,NULL); INSERT INTO `item_stats` VALUES (410,'B','Bronze Arrow',0.25,100.00,1,1,'BULK RIGHTHAND LEFTHAND','AMMO',0.10,-1,-1,-1,'0','0','0',0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,28,29,29,0,0,'Arrow',1,0.00,'ARROW',NULL,0.00,NULL,0.00,'0',0.00,0,NULL,0.0000,NULL,0,NULL,0,'Simple bronze arrows that deal a bit less damage than iron arrows. These are cheap and easily available in huge amounts.','nosound',50,NULL,NULL,NULL,NULL); INSERT INTO `item_stats` VALUES (411,'B','Item of Create Familiar',1.00,100.00,1,0,'BULK RIGHTFINGER LEFTFINGER','QUESTITEM STACKABLE',0.10,-1,-1,-1,'0','0','0',0.00,0.00,0.00,0.00,1.00,0.00,2.10,1.00,0.20,0.20,0.20,0.00,185,186,0,0,0,'0',3,400.00,'GENERIC','',0.00,'',0.00,'',0.00,0,0,0.0000,0,0,0,1,'','nosound',50,'create_familiar','',NULL,NULL); Modified: trunk/src/server/psserverchar.cpp =================================================================== --- trunk/src/server/psserverchar.cpp 2007-12-21 11:27:23 UTC (rev 484) +++ trunk/src/server/psserverchar.cpp 2007-12-21 16:34:43 UTC (rev 485) @@ -875,7 +875,7 @@ for ( size_t z = 0; z < merchantInfo->categories.GetSize(); z++ ) { psItemCategory * category = merchantInfo->categories[z]; - csString escpxml = EscpXML(category->name); + csString escpxml = EscpXML(category->name); buff.Format("<CATEGORY ID=\"%d\" " "NAME=\"%s\" />",category->id, escpxml.GetData()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |