From: Anders R. <ma...@us...> - 2003-10-18 13:09:51
|
Update of /cvsroot/planeshift/planeshift/src/server In directory sc8-pr-cvs1:/tmp/cvs-serv8568/src/server Modified Files: cachemanager.cpp cachemanager.h combatmanager.cpp Log Message: - Added practice of weapon skills when hitting an opponent. - Fixed a bug in the initialization of the weapon skill array. Index: cachemanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/cachemanager.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** cachemanager.cpp 17 Oct 2003 23:33:04 -0000 1.17 --- cachemanager.cpp 18 Oct 2003 13:09:18 -0000 1.18 *************** *** 555,558 **** --- 555,568 ---- } + PSSKILL CacheManager::ConvertSkill(int skill_id) + { + if (skill_id >= (int)PSSKILL_NONE && skill_id < (int)PSSKILL_COUNT) + { + return (PSSKILL)skill_id; + } + + return PSSKILL_NONE; + } + bool CacheManager::PreloadItemCategories() { Index: cachemanager.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/cachemanager.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cachemanager.h 9 Oct 2003 04:25:40 -0000 1.8 --- cachemanager.h 18 Oct 2003 13:09:18 -0000 1.9 *************** *** 145,148 **** --- 145,149 ---- PSITEMSTATS_ATTRIBUTE ConvertAttributeString(const char *attributestring); PSSKILL ConvertSkillString(const char *skillstring); + PSSKILL ConvertSkill(int skill_id); PSCHARACTER_GENDER ConvertGenderString(const char *genderstring); PSITEMSTATS_SLOTLIST slotMap[PSCHARACTER_SLOT_COUNT]; Index: combatmanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/combatmanager.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** combatmanager.cpp 18 Oct 2003 09:48:28 -0000 1.26 --- combatmanager.cpp 18 Oct 2003 13:09:18 -0000 1.27 *************** *** 454,457 **** --- 454,465 ---- psserver->npcmanager->QueueDamagePerception(event->attacker,dynamic_cast<gemNPC*>(event->target),event->FinalDamage); + // Successful attack, train skill. + for (int index = 0; index < PSITEMSTATS_WEAPONSKILL_INDEX_COUNT; index++) + { + PSSKILL skill = weapon->GetWeaponSkill((PSITEMSTATS_WEAPONSKILL_INDEX)index); + if (skill != PSSKILL_NONE) + event->attacker->GetCharacterData()->AddBaseSkillPractice(skill,1); + } + if (!hp) // check for dead { |