From: Keith F. <ven...@us...> - 2007-03-23 01:35:14
|
Update of /cvsroot/planeshift/planeshift/src/server/bulkobjects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29900/src/server/bulkobjects Modified Files: psitem.cpp psnpcdialog.cpp Log Message: - Committed fix to quality decay causing items to pop back to perfect sent by Socia. Thanks Socia! - Made dialog check each word in a trigger 1 by 1 if the entire trigger is not found. Index: psitem.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/psitem.cpp,v retrieving revision 1.250 retrieving revision 1.251 diff -C2 -d -r1.250 -r1.251 *** psitem.cpp 22 Mar 2007 00:41:07 -0000 1.250 --- psitem.cpp 23 Mar 2007 01:35:12 -0000 1.251 *************** *** 876,885 **** float psItem::AddDecay(float severityFactor) { ! if (!this) return 0; item_quality -= base_stats->GetDecayRate() * severityFactor * (1.0F-decay_resistance); ! if (item_quality < 0) { ! item_quality = 0; } Debug4(LOG_USER,0,"Item %s quality decayed by %1.2f to %1.2f.\n", GetName(), base_stats->GetDecayRate()*severityFactor*(1.0F-decay_resistance), item_quality); --- 876,886 ---- float psItem::AddDecay(float severityFactor) { ! if (!this) ! return 0; item_quality -= base_stats->GetDecayRate() * severityFactor * (1.0F-decay_resistance); ! if (item_quality < 1) { ! item_quality = 1; } Debug4(LOG_USER,0,"Item %s quality decayed by %1.2f to %1.2f.\n", GetName(), base_stats->GetDecayRate()*severityFactor*(1.0F-decay_resistance), item_quality); Index: psnpcdialog.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/psnpcdialog.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** psnpcdialog.cpp 22 Mar 2007 04:28:25 -0000 1.88 --- psnpcdialog.cpp 23 Mar 2007 01:35:12 -0000 1.89 *************** *** 646,651 **** { AddBadText(text,trigger); psString error("error"); ! NpcResponse * resp = FindResponse(error,text); // save the trigger that didn't work for possible display to devs --- 646,667 ---- { AddBadText(text,trigger); + + WordArray words(trigger); + for (size_t i=words.GetCount(); i>0; i--) + { + psString word(words.Get(i-1)); // try each word (in reverse order) of the trigger by itself before giving up + printf("ErrorResponse: Trying to find trigger '%s'\n", word.GetDataSafe() ); + + NpcResponse *resp = FindResponse(word,text); + if (resp) + { + resp->triggerText = trigger; + return resp; + } + } + + // Last resort psString error("error"); ! NpcResponse *resp = FindResponse(error,text); // save the trigger that didn't work for possible display to devs |