Changeset 6 for trunk/src/game/Player.cpp
- Timestamp:
- 11/19/08 13:22:12 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Player.cpp
r2 r6 357 357 m_ArmorProficiency = 0; 358 358 m_canParry = false; 359 m_canBlock = false; 359 360 m_canDualWield = false; 360 361 m_ammoDPS = 0.0f; … … 617 618 ++action_itr[i]; 618 619 } 619 620 UpdateBlockPercentage();621 620 622 621 for (PlayerCreateInfoItems::const_iterator item_id_itr = info->item.begin(); item_id_itr!=info->item.end(); ++item_id_itr++) … … 2249 2248 SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1+i, 0.0f); 2250 2249 2251 // Base parry percents 2252 SetFloatValue(PLAYER_PARRY_PERCENTAGE, 5.0f); 2253 2254 //Base block percentage 2255 SetFloatValue(PLAYER_BLOCK_PERCENTAGE, 5.0f); 2256 2250 SetFloatValue(PLAYER_PARRY_PERCENTAGE, 0.0f); 2251 SetFloatValue(PLAYER_BLOCK_PERCENTAGE, 0.0f); 2257 2252 SetUInt32Value(PLAYER_SHIELD_BLOCK, 0); 2258 2253 … … 3287 3282 updateVisualBits.SetBit(i); 3288 3283 3289 for(uint16 i = 0; i < INVENTORY_SLOT_BAG_END; i++)3290 {3291 updateVisualBits.SetBit((uint16)(PLAYER_FIELD_INV_SLOT_HEAD + i*2));3292 updateVisualBits.SetBit((uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (i*2) + 1));3293 }3294 3284 //Players visible items are not inventory stuff 3295 3285 //431) = 884 (0x374) = main weapon … … 3406 3396 3407 3397 // known spell 3408 if(HasSpell(trainer_spell->spell ->Id))3398 if(HasSpell(trainer_spell->spell)) 3409 3399 return TRAINER_SPELL_GRAY; 3410 3400 3411 3401 // check race/class requirement 3412 if(!IsSpellFitByClassAndRace(trainer_spell->spell ->Id))3402 if(!IsSpellFitByClassAndRace(trainer_spell->spell)) 3413 3403 return TRAINER_SPELL_RED; 3414 3404 3415 3405 // check level requirement 3416 if(getLevel() < ( trainer_spell->reqlevel ? trainer_spell->reqlevel : trainer_spell->spell->spellLevel))3406 if(getLevel() < trainer_spell->reqlevel) 3417 3407 return TRAINER_SPELL_RED; 3418 3408 3419 if(SpellChainNode const* spell_chain = spellmgr.GetSpellChainNode(trainer_spell->spell ->Id))3409 if(SpellChainNode const* spell_chain = spellmgr.GetSpellChainNode(trainer_spell->spell)) 3420 3410 { 3421 3411 // check prev.rank requirement … … 3432 3422 return TRAINER_SPELL_RED; 3433 3423 3424 // exist, already checked at loading 3425 SpellEntry const* spell = sSpellStore.LookupEntry(trainer_spell->spell); 3426 3434 3427 // secondary prof. or not prof. spell 3435 uint32 skill = trainer_spell->spell->EffectMiscValue[1];3436 3437 if( trainer_spell->spell->Effect[1] != SPELL_EFFECT_SKILL || !IsPrimaryProfessionSkill(skill))3428 uint32 skill = spell->EffectMiscValue[1]; 3429 3430 if(spell->Effect[1] != SPELL_EFFECT_SKILL || !IsPrimaryProfessionSkill(skill)) 3438 3431 return TRAINER_SPELL_GREEN; 3439 3432 3440 3433 // check primary prof. limit 3441 if(spellmgr.IsPrimaryProfessionFirstRankSpell( trainer_spell->spell->Id) && GetFreePrimaryProffesionPoints() == 0)3434 if(spellmgr.IsPrimaryProfessionFirstRankSpell(spell->Id) && GetFreePrimaryProffesionPoints() == 0) 3442 3435 return TRAINER_SPELL_RED; 3443 3436 … … 4877 4870 4878 4871 if(pskill == SKILL_DEFENSE) 4879 { 4880 UpdateBlockPercentage(); 4881 } 4872 UpdateDefenseBonusesMod(); 4882 4873 } 4883 4874 } … … 5791 5782 FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1); 5792 5783 uint32 current_reputation_rank1 = GetReputationRank(factionEntry1); 5793 if(factionEntry1 && current_reputation_rank1 <= Rep->reput ration_max_cap1)5784 if(factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1) 5794 5785 ModifyFactionReputation(factionEntry1, donerep1); 5795 5786 … … 5809 5800 FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2); 5810 5801 uint32 current_reputation_rank2 = GetReputationRank(factionEntry2); 5811 if(factionEntry2 && current_reputation_rank2 <= Rep->reput ration_max_cap2)5802 if(factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2) 5812 5803 ModifyFactionReputation(factionEntry2, donerep2); 5813 5804 … … 11553 11544 } 11554 11545 11555 QuestMenu *qm = PlayerTalkClass->GetQuestMenu();11556 qm ->ClearMenu();11546 QuestMenu &qm = PlayerTalkClass->GetQuestMenu(); 11547 qm.ClearMenu(); 11557 11548 11558 11549 for(QuestRelations::const_iterator i = pObjectQIR->lower_bound(pObject->GetEntry()); i != pObjectQIR->upper_bound(pObject->GetEntry()); ++i) … … 11561 11552 QuestStatus status = GetQuestStatus( quest_id ); 11562 11553 if ( status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus( quest_id ) ) 11563 qm ->AddMenuItem(quest_id, DIALOG_STATUS_REWARD_REP);11554 qm.AddMenuItem(quest_id, DIALOG_STATUS_REWARD_REP); 11564 11555 else if ( status == QUEST_STATUS_INCOMPLETE ) 11565 qm ->AddMenuItem(quest_id, DIALOG_STATUS_INCOMPLETE);11556 qm.AddMenuItem(quest_id, DIALOG_STATUS_INCOMPLETE); 11566 11557 else if (status == QUEST_STATUS_AVAILABLE ) 11567 qm ->AddMenuItem(quest_id, DIALOG_STATUS_CHAT);11558 qm.AddMenuItem(quest_id, DIALOG_STATUS_CHAT); 11568 11559 } 11569 11560 … … 11577 11568 11578 11569 if (pQuest->IsAutoComplete() && CanTakeQuest(pQuest, false)) 11579 qm ->AddMenuItem(quest_id, DIALOG_STATUS_REWARD_REP);11570 qm.AddMenuItem(quest_id, DIALOG_STATUS_REWARD_REP); 11580 11571 else if ( status == QUEST_STATUS_NONE && CanTakeQuest( pQuest, false ) ) 11581 qm ->AddMenuItem(quest_id, DIALOG_STATUS_AVAILABLE);11572 qm.AddMenuItem(quest_id, DIALOG_STATUS_AVAILABLE); 11582 11573 } 11583 11574 } … … 11585 11576 void Player::SendPreparedQuest( uint64 guid ) 11586 11577 { 11587 QuestMenu * pQuestMenu = PlayerTalkClass->GetQuestMenu();11588 if( !pQuestMenu || pQuestMenu->MenuItemCount() < 1)11578 QuestMenu& questMenu = PlayerTalkClass->GetQuestMenu(); 11579 if( questMenu.Empty() ) 11589 11580 return; 11590 11581 11591 uint32 status = pQuestMenu->GetItem(0).m_qIcon; 11592 if ( pQuestMenu->MenuItemCount() == 1 ) 11582 QuestMenuItem const& qmi0 = questMenu.GetItem( 0 ); 11583 11584 uint32 status = qmi0.m_qIcon; 11585 11586 // single element case 11587 if ( questMenu.MenuItemCount() == 1 ) 11593 11588 { 11594 11589 // Auto open -- maybe also should verify there is no greeting 11595 uint32 quest_id = pQuestMenu->GetItem(0).m_qId;11590 uint32 quest_id = qmi0.m_qId; 11596 11591 Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); 11597 11592 if ( pQuest ) … … 11608 11603 } 11609 11604 } 11605 // multiply entries 11610 11606 else 11611 11607 { … … 13772 13768 break; 13773 13769 } 13774 }13775 13776 //Unmount Player from previous mount, so speed bug with mount is no more...13777 if(IsMounted())13778 {13779 Unmount();13780 RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);13781 13770 } 13782 13771 … … 15627 15616 void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text, uint32 language) const 15628 15617 { 15629 bool pre = (msgtype==CHAT_MSG_EMOTE);15630 15631 15618 *data << (uint8)msgtype; 15632 15619 *data << (uint32)language; … … 15634 15621 *data << (uint32)language; //language 2.1.0 ? 15635 15622 *data << (uint64)GetGUID(); 15636 *data << (uint32)(text.length()+1+(pre?3:0)); 15637 if(pre) 15638 data->append("%s ",3); 15623 *data << (uint32)(text.length()+1); 15639 15624 *data << text; 15640 15625 *data << (uint8)chatTag(); … … 17152 17137 data << (float)0.01666667f; // game speed 17153 17138 GetSession()->SendPacket( &data ); 17139 17140 // set fly flag if in fly form or taxi flight to prevent visually drop at ground in showup moment 17141 if(HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) || isInFlight()) 17142 SetUnitMovementFlags(GetUnitMovementFlags() | MOVEMENTFLAG_FLYING2); 17154 17143 } 17155 17144 … … 17163 17152 static const AuraType auratypes[] = 17164 17153 { 17165 SPELL_AURA_MOD_FEAR, SPELL_AURA_TRANSFORM, SPELL_AURA_WATER_WALK,17166 SPELL_AURA_FEATHER_FALL, SPELL_AURA_HOVER, SPELL_AURA_SAFE_FALL,17167 SPELL_AURA_FLY, SPELL_AURA_ NONE17154 SPELL_AURA_MOD_FEAR, SPELL_AURA_TRANSFORM, SPELL_AURA_WATER_WALK, 17155 SPELL_AURA_FEATHER_FALL, SPELL_AURA_HOVER, SPELL_AURA_SAFE_FALL, 17156 SPELL_AURA_FLY, SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED, SPELL_AURA_NONE 17168 17157 }; 17169 17158 for(AuraType const* itr = &auratypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr) … … 18117 18106 } 18118 18107 18119 bool ItemPosCount::isContainedIn(ItemPosCountVec &vec) 18108 void Player::SetCanParry( bool value ) 18109 { 18110 if(m_canParry==value) 18111 return; 18112 18113 m_canParry = value; 18114 UpdateParryPercentage(); 18115 } 18116 18117 void Player::SetCanBlock( bool value ) 18118 { 18119 if(m_canBlock==value) 18120 return; 18121 18122 m_canBlock = value; 18123 UpdateBlockPercentage(); 18124 } 18125 18126 bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const 18120 18127 { 18121 18128 for(ItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr) 18122 { 18123 if(itr->pos == this->pos/* && itr->count == this.count*/) 18124 { 18129 if(itr->pos == this->pos) 18125 18130 return true; 18126 } 18127 } 18131 18128 18132 return false; 18129 18133 } 18130