Changeset 209 for trunk/src/game/Player.cpp
- Timestamp:
- 11/19/08 13:46:36 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Player.cpp
r207 r209 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 271 271 SetAcceptTicket(true); 272 272 273 // players always accept 273 // players always accept 274 274 if(GetSession()->GetSecurity() == SEC_PLAYER) 275 275 SetAcceptWhispers(true); … … 368 368 m_temporaryUnsummonedPetNumber = 0; 369 369 //cache for UNIT_CREATED_BY_SPELL to allow 370 //returning reage sts for temporarily removed pets370 //returning reagents for temporarily removed pets 371 371 //when dying/logging out 372 372 m_oldpetspell = 0; … … 434 434 CleanupsBeforeDelete(); 435 435 436 // it must be unloaded already in PlayerLogout and accessed only for loggined player 436 437 //m_social = NULL; 437 438 … … 488 489 bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ) 489 490 { 491 //FIXME: outfitId not used in player creating 492 490 493 Object::_Create(guidlow, 0, HIGHGUID_PLAYER); 491 494 … … 665 668 if (getPowerType()==POWER_MANA) 666 669 { 667 UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intel ect)670 UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intellect) 668 671 SetPower(POWER_MANA,GetMaxPower(POWER_MANA)); 669 672 } … … 831 834 } 832 835 833 uint32 UnderWaterTime = 1*MINUTE*1000; // default le angthL1 min836 uint32 UnderWaterTime = 1*MINUTE*1000; // default length 1 min 834 837 835 838 AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING); … … 1510 1513 if(GetSession()->Expansion() < mEntry->Expansion()) 1511 1514 { 1512 sLog.outDebug("Player %s using client without required expansion tried teleport to non access able map %u", GetName(), mapid);1515 sLog.outDebug("Player %s using client without required expansion tried teleport to non accessible map %u", GetName(), mapid); 1513 1516 1514 1517 if(GetTransport()) … … 1545 1548 // We have to perform this check before the teleport, otherwise the 1546 1549 // ObjectAccessor won't find the flag. 1547 if (duel && this->GetMapId()!=mapid)1550 if (duel && GetMapId()!=mapid) 1548 1551 { 1549 1552 GameObject* obj = ObjectAccessor::GetGameObject(*this, GetUInt64Value(PLAYER_DUEL_ARBITER)); … … 1555 1558 SetUnitMovementFlags(0); 1556 1559 1557 if (( this->GetMapId() == mapid) && (!m_transport))1560 if ((GetMapId() == mapid) && (!m_transport)) 1558 1561 { 1559 1562 // prepare zone change detect … … 3266 3269 updateVisualBits.SetCount(PLAYER_END); 3267 3270 3268 3271 // TODO: really implement OWNER_ONLY and GROUP_ONLY. Flags can be found in UpdateFields.h 3269 3272 3270 3273 updateVisualBits.SetBit(OBJECT_FIELD_GUID); … … 3279 3282 3280 3283 updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY); 3281 3284 updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY+1); 3282 3285 3283 3286 updateVisualBits.SetBit(UNIT_FIELD_TARGET); … … 3315 3318 updateVisualBits.SetBit(UNIT_FIELD_DISPLAYID); 3316 3319 updateVisualBits.SetBit(UNIT_FIELD_NATIVEDISPLAYID); 3320 updateVisualBits.SetBit(UNIT_FIELD_MOUNTDISPLAYID); 3317 3321 updateVisualBits.SetBit(UNIT_FIELD_BYTES_1); 3318 updateVisualBits.SetBit(UNIT_FIELD_MOUNTDISPLAYID);3319 3322 updateVisualBits.SetBit(UNIT_FIELD_PETNUMBER); 3320 3323 updateVisualBits.SetBit(UNIT_FIELD_PET_NAME_TIMESTAMP); … … 3324 3327 updateVisualBits.SetBit(UNIT_FIELD_BYTES_2); 3325 3328 3326 3327 3329 updateVisualBits.SetBit(PLAYER_DUEL_ARBITER); 3330 updateVisualBits.SetBit(PLAYER_DUEL_ARBITER+1); 3328 3331 updateVisualBits.SetBit(PLAYER_FLAGS); 3329 3330 3332 updateVisualBits.SetBit(PLAYER_GUILDID); 3333 updateVisualBits.SetBit(PLAYER_GUILDRANK); 3331 3334 updateVisualBits.SetBit(PLAYER_BYTES); 3332 3335 updateVisualBits.SetBit(PLAYER_BYTES_2); … … 3724 3727 void Player::SendDelayResponse(const uint32 ml_seconds) 3725 3728 { 3729 //FIXME: is this delay time arg really need? 50msec by default in code 3726 3730 WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 ); 3727 3731 data << (uint32)time(NULL); … … 3763 3767 } 3764 3768 3765 // update vis bility3769 // update visibility 3766 3770 ObjectAccessor::UpdateVisibilityForPlayer(this); 3767 3771 … … 4230 4234 // leave old channel 4231 4235 (*i)->Leave(GetGUID(),false); // not send leave channel, it already replaced at client 4232 std::string name = (*i)->GetName(); // st roe name, (*i)erase in LeftChannel4236 std::string name = (*i)->GetName(); // store name, (*i)erase in LeftChannel 4233 4237 LeftChannel(*i); // remove from player's channel list 4234 4238 cMgr->LeftChannel(name); // delete if empty … … 4265 4269 if(modGroup >= BASEMOD_END || modType >= MOD_END) 4266 4270 { 4267 sLog.outError("ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");4271 sLog.outError("ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); 4268 4272 return; 4269 4273 } … … 4302 4306 if(modGroup >= BASEMOD_END || modType > MOD_END) 4303 4307 { 4304 sLog.outError("ERROR: trial to access non existed BaseModGroup or wrong BaseModType!");4308 sLog.outError("ERROR: trial to access non existed BaseModGroup or wrong BaseModType!"); 4305 4309 return 0.0f; 4306 4310 } … … 4974 4978 if (_spell_idx->second->skillId == id) 4975 4979 { 4976 // this may remove more than one spell (depend ants)4980 // this may remove more than one spell (dependents) 4977 4981 removeSpell(itr->first); 4978 4982 next = m_spells.begin(); … … 5249 5253 // code block for underwater state update 5250 5254 UpdateUnderwaterState(m, x, y, z); 5251 5252 5255 5253 5256 CheckExploreSystem(); … … 6314 6317 SetRestType(REST_TYPE_NO); 6315 6318 6316 // Set player to FFA PVP when not in rested enviro ment.6319 // Set player to FFA PVP when not in rested environment. 6317 6320 if(sWorld.IsFFAPvPRealm()) 6318 6321 SetFlag(PLAYER_FLAGS,PLAYER_FLAGS_FFA_PVP); … … 6933 6936 6934 6937 if (roll_chance_f(chance)) 6935 this->CastSpell(Target, spellInfo->Id, true, item);6938 CastSpell(Target, spellInfo->Id, true, item); 6936 6939 } 6937 6940 … … 7796 7799 data << uint32(0xaa7) << uint32(0x0); // 23 2727 Fel Reaver - Horde control 7797 7800 data << uint32(0xaa6) << uint32(0x0); // 24 2726 Fel Reaver - Alliance control 7798 data << uint32(0xaa5) << uint32(0x1); // 25 2725 Fel Reaver uncontrol ed (1 - yes, 0 - no)7801 data << uint32(0xaa5) << uint32(0x1); // 25 2725 Fel Reaver uncontrolled (1 - yes, 0 - no) 7799 7802 data << uint32(0xaa4) << uint32(0x0); // 26 2724 Boold Elf - Horde control 7800 7803 data << uint32(0xaa3) << uint32(0x0); // 27 2723 Boold Elf - Alliance control … … 8021 8024 data << uint64(guid); 8022 8025 uint32 cost = sWorld.getConfig(CONFIG_NO_RESET_TALENT_COST) ? 0 : resetTalentsCost(); 8023 data << cost;8024 8026 data << cost; 8025 8027 GetSession()->SendPacket( &data ); … … 8622 8624 } 8623 8625 8626 8624 8627 bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const 8625 8628 { … … 9031 9034 } 9032 9035 9033 // not specific slot or have sp ece for partly store only in specific slot9036 // not specific slot or have space for partly store only in specific slot 9034 9037 9035 9038 // in specific bag … … 9686 9689 return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; 9687 9690 9688 // offhand item must can be stored in invent itory for offhand item and it also must be unequipped9691 // offhand item must can be stored in inventory for offhand item and it also must be unequipped 9689 9692 Item *offItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND ); 9690 9693 ItemPosCountVec off_dest; … … 9797 9800 } 9798 9801 9799 // not specific slot or have sp ece for partly store only in specific slot9802 // not specific slot or have space for partly store only in specific slot 9800 9803 9801 9804 // in specific bag … … 9859 9862 } 9860 9863 9861 // not specific bag or have sp ece for partly store only in specific bag9864 // not specific bag or have space for partly store only in specific bag 9862 9865 9863 9866 // search stack for merge to … … 10491 10494 10492 10495 // if this original item then it need create record in inventory 10493 // in case trade we laready have item in other player inventory10496 // in case trade we already have item in other player inventory 10494 10497 pLastItem->SetState(in_characterInventoryDB ? ITEM_CHANGED : ITEM_NEW, this); 10495 10498 } … … 10735 10738 { 10736 10739 // used when entering arena 10737 // d istroys all conjured items10740 // destroys all conjured items 10738 10741 sLog.outDebug( "STORAGE: DestroyConjuredItems" ); 10739 10742 … … 11283 11286 if(pTrader) 11284 11287 { 11285 // send yellow "Trade cancel led" message to both traders11288 // send yellow "Trade canceled" message to both traders 11286 11289 WorldSession* ws; 11287 11290 ws = GetSession(); … … 11369 11372 } 11370 11373 } 11371 11372 11374 11373 11375 void Player::RemoveAllEnchantments(EnchantmentSlot slot) … … 11499 11501 { 11500 11502 int32 basepoints = int32(enchant_amount); 11501 // Random Property Exist - try found basepoints for spell (basepoints depen cs from item suffix factor)11503 // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor) 11502 11504 if (item->GetItemRandomPropertyId() !=0 && !enchant_amount) 11503 11505 { … … 12196 12198 12197 12199 // if not exist then created with set uState==NEW and rewarded=false 12198 QuestStatusData& questStatusData = 12200 QuestStatusData& questStatusData = mQuestStatus[quest_id]; 12199 12201 if (questStatusData.uState != QUEST_NEW) 12200 12202 questStatusData.uState = QUEST_CHANGED; … … 12568 12570 12569 12571 // each-from-all exclusive group ( < 0) 12570 // can be start if only all quests in prev quest exclusive group compl ited and rewarded12572 // can be start if only all quests in prev quest exclusive group completed and rewarded 12571 12573 ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); 12572 12574 ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); … … 14264 14266 //NOTE: the "order by `bag`" is important because it makes sure 14265 14267 //the bagMap is filled before items in the bags are loaded 14266 //NOTE2: the "order by `slot`" is needed becau e mainhand weapons are (wrongly?)14268 //NOTE2: the "order by `slot`" is needed because mainhand weapons are (wrongly?) 14267 14269 //expected to be equipped before offhand items (TODO: fixme) 14268 14270 … … 14391 14393 { 14392 14394 // fill mail 14393 MailItemsInfo mi; // item list prep ering14395 MailItemsInfo mi; // item list preparing 14394 14396 14395 14397 for(int i = 0; !problematicItems.empty() && i < MAX_MAIL_ITEMS; ++i) … … 14939 14941 } 14940 14942 14941 //Send opcode 811. true or f lase means, whether you have current raid/heroic instances14943 //Send opcode 811. true or false means, whether you have current raid/heroic instances 14942 14944 data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP); 14943 14945 data << uint32(hasBeenSaved); … … 15927 15929 } 15928 15930 15929 15930 15931 void Player::RemoveMiniPet() 15931 15932 { … … 16442 16443 if ((*i)->isVisibleForOrDetect(this,true)) 16443 16444 { 16445 16444 16446 (*i)->SendUpdateToPlayer(this); 16445 16447 m_clientGUIDs.insert((*i)->GetGUID()); … … 16620 16622 WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+m_spells.size()*8); 16621 16623 data << GetGUID(); 16622 data << uint8(0x0); 16624 data << uint8(0x0); // flags (0x1, 0x2) 16623 16625 time_t curTime = time(NULL); 16624 16626 for(PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) … … 17016 17018 return; 17017 17019 17018 // Get spell coold wn17020 // Get spell cooldown 17019 17021 int32 cooldown = GetSpellRecoveryTime(spellInfo); 17020 17022 // Apply spellmods … … 17588 17590 { 17589 17591 WorldPacket data(SMSG_SET_REST_START, 4); 17590 data << uint32(0); // unknown, may be rest state time or exp irience17592 data << uint32(0); // unknown, may be rest state time or experience 17591 17593 GetSession()->SendPacket(&data); 17592 17594 … … 18186 18188 } 18187 18189 default: 18188 sLog.outError("HasItemFitToSpellReqirements: Not hand eled spell reqirement for item class %u",spellInfo->EquippedItemClass);18190 sLog.outError("HasItemFitToSpellReqirements: Not handled spell requirement for item class %u",spellInfo->EquippedItemClass); 18189 18191 break; 18190 18192 } … … 18231 18233 uint32 Player::GetResurrectionSpellId() 18232 18234 { 18233 // search priceless resurrection poss abilities18235 // search priceless resurrection possibilities 18234 18236 uint32 prio = 0; 18235 18237 uint32 spell_id = 0; … … 18387 18389 Item* item = GetWeaponForAttack(attType,true); 18388 18390 18389 // unarm med only with base attack18391 // unarmed only with base attack 18390 18392 if(attType != BASE_ATTACK && !item) 18391 18393 return 0; … … 18607 18609 { 18608 18610 if(m_canParry==value) 18609 return; 18611 return; 18610 18612 18611 18613 m_canParry = value; … … 18616 18618 { 18617 18619 if(m_canBlock==value) 18618 return; 18620 return; 18619 18621 18620 18622 m_canBlock = value;