Changeset 152
- Timestamp:
- 11/19/08 13:41:09 (17 years ago)
- Location:
- trunk/src
- Files:
-
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bindings/scripts/ScriptMgr.cpp
r150 r152 1839 1839 //*** Functions used internally *** 1840 1840 1841 T rinity_DLL_EXPORT1842 c onst char* ScriptsVersion()1841 TRINITY_DLL_EXPORT 1842 char const* ScriptsVersion() 1843 1843 { 1844 1844 return "Default Trinity scripting library"; -
trunk/src/game/Opcodes.cpp
r102 r152 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 … … 314 314 /*0x11B*/ { "CMSG_UNACCEPT_TRADE", STATUS_LOGGEDIN, &WorldSession::HandleUnacceptTradeOpcode }, 315 315 /*0x11C*/ { "CMSG_CANCEL_TRADE", STATUS_AUTHED, &WorldSession::HandleCancelTradeOpcode }, 316 // also send after logout complete317 316 /*0x11D*/ { "CMSG_SET_TRADE_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleSetTradeItemOpcode }, 318 317 /*0x11E*/ { "CMSG_CLEAR_TRADE_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleClearTradeItemOpcode }, … … 526 525 /*0x1EE*/ { "SMSG_AUTH_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, 527 526 /*0x1EF*/ { "MSG_GM_SHOWLABEL", STATUS_NEVER, &WorldSession::Handle_NULL }, 528 /*0x1F0*/ { "CMSG_PET_CAST_SPELL", STATUS_LOGGEDIN, &WorldSession::Handle AddDynamicTargetObsoleteOpcode},527 /*0x1F0*/ { "CMSG_PET_CAST_SPELL", STATUS_LOGGEDIN, &WorldSession::HandlePetCastSpellOpcode }, 529 528 /*0x1F1*/ { "MSG_SAVE_GUILD_EMBLEM", STATUS_LOGGEDIN, &WorldSession::HandleGuildSaveEmblemOpcode }, 530 529 /*0x1F2*/ { "MSG_TABARDVENDOR_ACTIVATE", STATUS_LOGGEDIN, &WorldSession::HandleTabardVendorActivateOpcode}, -
trunk/src/game/Pet.cpp
r149 r152 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 … … 189 189 if(!IsPositionValid()) 190 190 { 191 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %d Y: ^%d)", GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); 191 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", 192 GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); 192 193 delete result; 193 194 return false; … … 206 207 return true; 207 208 } 208 if(getPetType()==HUNTER_PET || getPetType()==SUMMON_PET && cinfo->type == CREATURE_TYPE_DEMON && owner->getClass() == CLASS_WARLOCK)209 if(getPetType()==HUNTER_PET || (getPetType()==SUMMON_PET && cinfo->type == CREATURE_TYPE_DEMON && owner->getClass() == CLASS_WARLOCK)) 209 210 m_charmInfo->SetPetNumber(pet_number, true); 210 211 else … … 1219 1220 WorldPacket data(SMSG_SPELL_COOLDOWN, (8+1+result->GetRowCount()*8)); 1220 1221 data << GetGUID(); 1221 data << uint8(0x0); 1222 data << uint8(0x0); // flags (0x1, 0x2) 1222 1223 1223 1224 do … … 1367 1368 remaincharges = -1; 1368 1369 1369 1370 1371 1370 /// do not load single target auras (unless they were cast by the player) 1371 if (caster_guid != GetGUID() && IsSingleTargetSpell(spellproto)) 1372 continue; 1372 1373 1373 1374 Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL); … … 1401 1402 1402 1403 if (i != 3) 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1404 continue; 1405 1406 if(itr->second->IsPassive()) 1407 continue; 1408 1409 /// do not save single target auras (unless they were cast by the player) 1410 if (itr->second->GetCasterGUID() != GetGUID() && IsSingleTargetSpell(spellInfo)) 1411 continue; 1412 1413 CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_index,amount,maxduration,remaintime,remaincharges) " 1414 "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d')", 1415 m_charmInfo->GetPetNumber(), itr->second->GetCasterGUID(),(uint32)(*itr).second->GetId(), (uint32)(*itr).second->GetEffIndex(),(*itr).second->GetModifier()->m_amount,int((*itr).second->GetAuraMaxDuration()),int((*itr).second->GetAuraDuration()),int((*itr).second->m_procCharges)); 1415 1416 } 1416 1417 } -
trunk/src/game/Pet.h
r126 r152 97 97 PET_TALK_SPECIAL_SPELL = 0, 98 98 PET_TALK_ATTACK = 1 99 }; 100 101 enum PetNameInvalidReason 102 { 103 PET_NAME_INVALID = 1, 104 PET_NAME_NO_NAME = 2, 105 PET_NAME_TOO_SHORT = 3, 106 PET_NAME_TOO_LONG = 4, 107 PET_NAME_MIXED_LANGUAGES = 6, 108 PET_NAME_PROFANE = 7, 109 PET_NAME_RESERVED = 8, 110 PET_NAME_THREE_CONSECUTIVE = 11, 111 PET_NAME_INVALID_SPACE = 12, 112 PET_NAME_CONSECUTIVE_SPACES = 13, 113 PET_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 14, 114 PET_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 15, 115 PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 16 99 116 }; 100 117 -
trunk/src/game/PetHandler.cpp
r135 r152 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 … … 379 379 void WorldSession::HandlePetRename( WorldPacket & recv_data ) 380 380 { 381 CHECK_PACKET_SIZE(recv_data, 8+1+1+1+1+1+1+1);381 CHECK_PACKET_SIZE(recv_data, 8+1); 382 382 383 383 sLog.outDetail( "HandlePetRename. CMSG_PET_RENAME\n" ); … … 391 391 recv_data >> petguid; 392 392 recv_data >> name; 393 CHECK_PACKET_SIZE(recv_data, recv_data.rpos() + 1); 393 394 recv_data >> isdeclined; 394 395 … … 400 401 return; 401 402 402 if((!ObjectMgr::IsValidPetName(name)) || (objmgr.IsReservedName(name))) 403 { 404 SendNotification(LANG_PET_INVALID_NAME); 405 return; 406 } 403 if(!ObjectMgr::IsValidPetName(name)) 404 { 405 SendPetNameInvalid(PET_NAME_INVALID, name, NULL); 406 return; 407 } 408 409 if(objmgr.IsReservedName(name)) 410 { 411 SendPetNameInvalid(PET_NAME_RESERVED, name, NULL); 412 return; 413 } 414 407 415 pet->SetName(name); 408 416 … … 416 424 { 417 425 for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) 426 { 427 CHECK_PACKET_SIZE(recv_data, recv_data.rpos() + 1); 418 428 recv_data >> declinedname.name[i]; 429 } 419 430 420 431 std::wstring wname; 421 Utf8toWStr(name, wname);432 Utf8toWStr(name, wname); 422 433 if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname,0),declinedname)) 423 434 { 424 Send Notification(LANG_PET_INVALID_NAME);435 SendPetNameInvalid(PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME, name, &declinedname); 425 436 return; 426 437 } … … 434 445 CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber()); 435 446 CharacterDatabase.PExecute("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%u','%s','%s','%s','%s','%s')", 436 pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(),declinedname.name[2].c_str(),declinedname.name[3].c_str(),declinedname.name[4].c_str());447 pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str()); 437 448 } 438 449 439 450 CharacterDatabase.escape_string(name); 440 CharacterDatabase.PExecute("UPDATE character_pet SET name = '%s', renamed = '1' WHERE owner = '%u' AND id = '%u'", name.c_str(), _player->GetGUIDLow(),pet->GetCharmInfo()->GetPetNumber());451 CharacterDatabase.PExecute("UPDATE character_pet SET name = '%s', renamed = '1' WHERE owner = '%u' AND id = '%u'", name.c_str(), _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber()); 441 452 CharacterDatabase.CommitTransaction(); 442 453 … … 446 457 void WorldSession::HandlePetAbandon( WorldPacket & recv_data ) 447 458 { 448 CHECK_PACKET_SIZE(recv_data, 8);459 CHECK_PACKET_SIZE(recv_data, 8); 449 460 450 461 uint64 guid; … … 453 464 454 465 // pet/charmed 455 Creature* pet =ObjectAccessor::GetCreatureOrPet(*_player, guid);466 Creature* pet = ObjectAccessor::GetCreatureOrPet(*_player, guid); 456 467 if(pet) 457 468 { … … 581 592 } 582 593 583 void WorldSession::Handle AddDynamicTargetObsoleteOpcode( WorldPacket& recvPacket )594 void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket ) 584 595 { 585 596 sLog.outDetail("WORLD: CMSG_PET_CAST_SPELL"); … … 601 612 if(!pet || (pet != _player->GetPet() && pet!= _player->GetCharm())) 602 613 { 603 sLog.outError( "Handle AddDynamicTargetObsoleteOpcode.Pet %u isn't pet of player %s .\n", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );614 sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .\n", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() ); 604 615 return; 605 616 } … … 656 667 } 657 668 } 669 670 void WorldSession::SendPetNameInvalid(uint32 error, std::string name, DeclinedName *declinedName) 671 { 672 WorldPacket data(SMSG_PET_NAME_INVALID, 4 + name.size() + 1 + 1); 673 data << uint32(error); 674 data << name; 675 if(declinedName) 676 { 677 data << uint8(1); 678 for(uint32 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) 679 data << declinedName->name[i]; 680 } 681 else 682 data << uint8(0); 683 SendPacket(&data); 684 } -
trunk/src/game/WorldSession.h
r112 r152 31 31 struct ItemPrototype; 32 32 struct AuctionEntry; 33 struct DeclinedName; 33 34 34 35 class Creature; … … 83 84 void SendNotification(const char *format,...) ATTR_PRINTF(2,3); 84 85 void SendNotification(int32 string_id,...); 86 void SendPetNameInvalid(uint32 error, std::string name, DeclinedName *declinedName); 85 87 void SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type); 86 88 void SendPartyResult(PartyOperation operation, std::string member, PartyResult res); … … 89 91 uint32 GetSecurity() const { return _security; } 90 92 uint32 GetAccountId() const { return _accountId; } 91 //std::string const& GetRemoteAddress() const { return m_remoteaddress; }92 93 Player* GetPlayer() const { return _player; } 93 94 char const* GetPlayerName() const; … … 117 118 void QueuePacket(WorldPacket* new_packet); 118 119 bool Update(uint32 diff); 119 120 120 121 /// Handle the authentication waiting queue (to be completed) 121 122 void SendAuthWaitQue(uint32 position); … … 534 535 void HandlePetUnlearnOpcode( WorldPacket& recvPacket ); 535 536 void HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ); 536 void Handle AddDynamicTargetObsoleteOpcode( WorldPacket& recvPacket );537 void HandlePetCastSpellOpcode( WorldPacket& recvPacket ); 537 538 538 539 void HandleSetActionBar(WorldPacket& recv_data);