Changeset 207
- Timestamp:
- 11/19/08 13:46:22 (17 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 1 removed
- 25 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/framework/Dynamic/ObjectRegistry.h
r206 r207 27 27 28 28 #include <string> 29 #include <vector> 29 30 #include <map> 30 31 -
trunk/src/game/ArenaTeam.cpp
r111 r207 91 91 uint8 plClass; 92 92 93 // arena team is full (can't have more than type * 2 players!) 93 94 if(GetMembersSize() >= GetType() * 2) 94 {95 // arena team is full (can't have more than type * 2 players!)96 // return false97 95 return false; 98 } 99 100 if(!objmgr.GetPlayerNameByGUID(PlayerGuid, plName)) // player doesnt exist 101 return false; 102 // player already in arenateam of that size 103 if(Player::GetArenaTeamIdFromDB(PlayerGuid, GetType()) != 0) 104 { 105 sLog.outError("Arena::AddMember() : player already in this sized team"); 106 return false; 96 97 Player *pl = objmgr.GetPlayer(PlayerGuid); 98 if(pl) 99 { 100 if(pl->GetArenaTeamId(GetType())) 101 { 102 sLog.outError("Arena::AddMember() : player already in this sized team"); 103 return false; 104 } 105 106 plClass = (uint8)pl->getClass(); 107 plName = pl->GetName(); 108 } 109 else 110 { 111 // 0 1 112 QueryResult *result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", GUID_LOPART(PlayerGuid)); 113 if(!result) 114 return false; 115 116 plName = (*result)[0].GetCppString(); 117 plClass = (*result)[1].GetUInt8(); 118 delete result; 119 120 // check if player already in arenateam of that size 121 if(Player::GetArenaTeamIdFromDB(PlayerGuid, GetType()) != 0) 122 { 123 sLog.outError("Arena::AddMember() : player already in this sized team"); 124 return false; 125 } 107 126 } 108 127 … … 110 129 // this will be prevent attempt joining player to many arenateams and corrupt arena team data integrity 111 130 Player::RemovePetitionsAndSigns(PlayerGuid, GetType()); 112 113 Player *pl = objmgr.GetPlayer(PlayerGuid);114 if(pl)115 {116 plClass = (uint8)pl->getClass();117 }118 else119 {120 QueryResult *result = CharacterDatabase.PQuery("SELECT class FROM characters WHERE guid='%u'", GUID_LOPART(PlayerGuid));121 if(!result)122 return false;123 plClass = (*result)[0].GetUInt8();124 delete result;125 }126 131 127 132 ArenaTeamMember newmember; -
trunk/src/game/Chat.h
r177 r207 466 466 // Utility methods for commands 467 467 void ShowTicket(uint64 guid, char const* text, char const* time); 468 uint32 GetTicketIDByNum(uint32 num);469 468 bool LookupPlayerSearchCommand(QueryResult* result, int32 limit); 470 469 bool HandleBanListHelper(QueryResult* result); -
trunk/src/game/CreatureAI.cpp
r102 r207 20 20 21 21 #include "CreatureAI.h" 22 #include "HateMatrix.h"23 22 24 23 CreatureAI::~CreatureAI() 25 24 { 26 25 } 27 28 uint32 HateBinder::si_noHateValue=0; -
trunk/src/game/ItemHandler.cpp
r102 r207 50 50 return; //check count - if zero it's fake packet 51 51 52 if(!_player->IsValidPos(srcbag,srcslot)) 53 { 54 _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); 55 return; 56 } 57 58 if(!_player->IsValidPos(dstbag,dstslot)) 59 { 60 _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); 61 return; 62 } 63 52 64 _player->SplitItem( src, dst, count ); 53 65 } … … 66 78 if(srcslot==dstslot) 67 79 return; 80 81 if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot)) 82 { 83 _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); 84 return; 85 } 86 87 if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot)) 88 { 89 _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); 90 return; 91 } 68 92 69 93 uint16 src = ( (INVENTORY_SLOT_BAG_0 << 8) | srcslot ); … … 109 133 if(src==dst) 110 134 return; 135 136 if(!_player->IsValidPos(srcbag,srcslot)) 137 { 138 _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); 139 return; 140 } 141 142 if(!_player->IsValidPos(dstbag,dstslot)) 143 { 144 _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); 145 return; 146 } 111 147 112 148 _player->SwapItem( src, dst ); … … 747 783 return; 748 784 785 if(!_player->IsValidPos(dstbag,NULL_SLOT)) 786 { 787 _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); 788 return; 789 } 790 749 791 uint16 src = pItem->GetPos(); 750 792 -
trunk/src/game/Level2.cpp
r177 r207 37 37 #include "SpellMgr.h" 38 38 #include "AccountMgr.h" 39 #include "GMTicketMgr.h" 39 40 #include "WaypointManager.h" 40 41 #include "Util.h" … … 863 864 if(srcslot==dstslot) 864 865 return true; 865 866 867 if(!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot)) 868 return false; 869 870 if(!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot)) 871 return false; 872 866 873 uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot); 867 874 uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot); … … 1796 1803 else 1797 1804 { 1798 QueryResult *result = CharacterDatabase.PQuery("SELECT totaltime FROM characters WHERE guid = '%u'", targetGUID);1805 QueryResult *result = CharacterDatabase.PQuery("SELECT totaltime FROM characters WHERE guid = '%u'", GUID_LOPART(targetGUID)); 1799 1806 if (!result) 1800 1807 { … … 1921 1928 } 1922 1929 1923 size_t count; 1924 QueryResult *result = CharacterDatabase.Query("SELECT COUNT(ticket_id) FROM character_ticket"); 1925 if(result) 1926 { 1927 count = (*result)[0].GetUInt32(); 1928 delete result; 1929 } 1930 else 1931 count = 0; 1930 size_t count = ticketmgr.GetTicketCount(); 1932 1931 1933 1932 bool accept = m_session->GetPlayer()->isAcceptTickets(); … … 1976 1975 { 1977 1976 PSendSysMessage(LANG_COMMAND_TICKENOTEXIST, num); 1978 delete result;1979 1977 SetSentErrorMessage(true); 1980 1978 return false; … … 1983 1981 Field* fields = result->Fetch(); 1984 1982 1985 uint 64 guid = fields[0].GetUInt64();1983 uint32 guid = fields[0].GetUInt32(); 1986 1984 char const* text = fields[1].GetString(); 1987 1985 char const* time = fields[2].GetString(); 1988 1986 1989 ShowTicket( guid,text,time);1987 ShowTicket(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER),text,time); 1990 1988 delete result; 1991 1989 return true; … … 2007 2005 2008 2006 // ticket $char_name 2009 QueryResult *result = CharacterDatabase.PQuery("SELECT ticket_text,ticket_lastchange FROM character_ticket WHERE guid = '%u' ORDER BY ticket_id ASC",GUID_LOPART(guid)); 2010 2011 if(!result) 2012 return false; 2013 2014 Field* fields = result->Fetch(); 2015 2016 char const* text = fields[0].GetString(); 2017 char const* time = fields[1].GetString(); 2018 2019 ShowTicket(guid,text,time); 2020 delete result; 2021 2022 return true; 2023 } 2024 2025 uint32 ChatHandler::GetTicketIDByNum(uint32 num) 2026 { 2027 QueryResult *result = CharacterDatabase.Query("SELECT ticket_id FROM character_ticket"); 2028 2029 if(!result || num > result->GetRowCount()) 2030 { 2031 PSendSysMessage(LANG_COMMAND_TICKENOTEXIST, num); 2032 delete result; 2033 return 0; 2034 } 2035 2036 for(uint32 i = 1; i < num; ++i) 2037 result->NextRow(); 2038 2039 Field* fields = result->Fetch(); 2040 2041 uint32 id = fields[0].GetUInt32(); 2042 delete result; 2043 return id; 2007 GMTicket* ticket = ticketmgr.GetGMTicket(GUID_LOPART(guid)); 2008 if(!ticket) 2009 return false; 2010 2011 std::string time = TimeToTimestampStr(ticket->GetLastUpdate()); 2012 2013 ShowTicket(guid, ticket->GetText(), time.c_str()); 2014 2015 return true; 2044 2016 } 2045 2017 … … 2054 2026 if(strncmp(px,"all",4) == 0) 2055 2027 { 2056 QueryResult *result = CharacterDatabase.Query("SELECT guid FROM character_ticket"); 2057 2058 if(!result) 2059 return true; 2060 2061 // notify players about ticket deleting 2062 do 2063 { 2064 Field* fields = result->Fetch(); 2065 2066 uint64 guid = fields[0].GetUInt64(); 2067 2068 if(Player* sender = objmgr.GetPlayer(guid)) 2069 sender->GetSession()->SendGMTicketGetTicket(0x0A,0); 2070 2071 }while(result->NextRow()); 2072 2073 delete result; 2074 2075 CharacterDatabase.PExecute("DELETE FROM character_ticket"); 2028 ticketmgr.DeleteAll(); 2076 2029 SendSysMessage(LANG_COMMAND_ALLTICKETDELETED); 2077 2030 return true; … … 2083 2036 if(num > 0) 2084 2037 { 2085 QueryResult *result = CharacterDatabase.PQuery("SELECT ticket_id,guid FROM character_ticket ORDER BY ticket_id ASC "_OFFSET_,num-1); 2086 2038 QueryResult* result = CharacterDatabase.PQuery("SELECT guid FROM character_ticket ORDER BY ticket_id ASC "_OFFSET_,num-1); 2087 2039 if(!result) 2088 2040 { 2089 2041 PSendSysMessage(LANG_COMMAND_TICKENOTEXIST, num); 2090 delete result;2091 2042 SetSentErrorMessage(true); 2092 2043 return false; … … 2095 2046 Field* fields = result->Fetch(); 2096 2047 2097 uint32 id = fields[0].GetUInt32(); 2098 uint64 guid = fields[1].GetUInt64(); 2048 uint32 guid = fields[0].GetUInt32(); 2099 2049 delete result; 2100 2050 2101 CharacterDatabase.PExecute("DELETE FROM character_ticket WHERE ticket_id = '%u'",id);2102 2103 // notify players about ticket deleting2104 if(Player* sender = objmgr.GetPlayer(guid))2105 { 2106 sender->GetSession()->SendGMTicketGetTicket(0x0A,0);2107 PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL, sender->GetName());2051 ticketmgr.Delete(guid); 2052 2053 //notify player 2054 if(Player* pl = objmgr.GetPlayer(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER))) 2055 { 2056 pl->GetSession()->SendGMTicketGetTicket(0x0A, 0); 2057 PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL, pl->GetName()); 2108 2058 } 2109 2059 else 2110 SendSysMessage(LANG_COMMAND_TICKETDEL);2060 PSendSysMessage(LANG_COMMAND_TICKETDEL); 2111 2061 2112 2062 return true; … … 2128 2078 2129 2079 // delticket $char_name 2130 CharacterDatabase.PExecute("DELETE FROM character_ticket WHERE guid = '%u'",GUID_LOPART(guid));2080 ticketmgr.Delete(GUID_LOPART(guid)); 2131 2081 2132 2082 // notify players about ticket deleting -
trunk/src/game/Makefile.am
r174 r207 115 115 $(srcdir)/GlobalEvents.cpp \ 116 116 $(srcdir)/GlobalEvents.h \ 117 $(srcdir)/GMTicketHandler.cpp \ 118 $(srcdir)/GMTicketMgr.cpp \ 119 $(srcdir)/GMTicketMgr.h \ 117 120 $(srcdir)/GossipDef.cpp \ 118 121 $(srcdir)/GossipDef.h \ … … 131 134 $(srcdir)/Guild.h \ 132 135 $(srcdir)/GuildHandler.cpp \ 133 $(srcdir)/HateMatrix.h \134 136 $(srcdir)/HomeMovementGenerator.cpp \ 135 137 $(srcdir)/HomeMovementGenerator.h \ -
trunk/src/game/MiscHandler.cpp
r173 r207 361 361 } 362 362 363 void WorldSession::SendGMTicketGetTicket(uint32 status, char const* text)364 {365 int len = text ? strlen(text) : 0;366 WorldPacket data( SMSG_GMTICKET_GETTICKET, (4+len+1+4+2+4+4) );367 data << uint32(status); // standard 0x0A, 0x06 if text present368 if(status == 6)369 {370 data << text; // ticket text371 data << uint8(0x7); // ticket category372 data << float(0); // time from ticket creation?373 data << float(0); // const374 data << float(0); // const375 data << uint8(0); // const376 data << uint8(0); // const377 }378 SendPacket( &data );379 }380 381 void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/ )382 {383 WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 );384 data << (uint32)time(NULL);385 data << (uint32)0;386 SendPacket( &data );387 388 uint64 guid;389 Field *fields;390 guid = GetPlayer()->GetGUID();391 392 QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(ticket_id) FROM character_ticket WHERE guid = '%u'", GUID_LOPART(guid));393 394 if (result)395 {396 int cnt;397 fields = result->Fetch();398 cnt = fields[0].GetUInt32();399 delete result;400 401 if ( cnt > 0 )402 {403 QueryResult *result2 = CharacterDatabase.PQuery("SELECT ticket_text FROM character_ticket WHERE guid = '%u'", GUID_LOPART(guid));404 if(result2)405 {406 Field *fields2 = result2->Fetch();407 SendGMTicketGetTicket(0x06,fields2[0].GetString());408 delete result2;409 }410 }411 else412 SendGMTicketGetTicket(0x0A,0);413 }414 }415 416 void WorldSession::HandleGMTicketUpdateTextOpcode( WorldPacket & recv_data )417 {418 CHECK_PACKET_SIZE(recv_data,1);419 420 std::string ticketText;421 recv_data >> ticketText;422 423 CharacterDatabase.escape_string(ticketText);424 CharacterDatabase.PExecute("UPDATE character_ticket SET ticket_text = '%s' WHERE guid = '%u'", ticketText.c_str(), _player->GetGUIDLow());425 }426 427 void WorldSession::HandleGMTicketDeleteOpcode( WorldPacket & /*recv_data*/ )428 {429 uint32 guid = GetPlayer()->GetGUIDLow();430 431 CharacterDatabase.PExecute("DELETE FROM character_ticket WHERE guid = '%u' LIMIT 1",guid);432 433 WorldPacket data( SMSG_GMTICKET_DELETETICKET, 4 );434 data << uint32(9);435 SendPacket( &data );436 437 SendGMTicketGetTicket(0x0A, 0);438 }439 440 void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )441 {442 CHECK_PACKET_SIZE(recv_data, 4*4+1+2*4);443 444 uint32 map;445 float x, y, z;446 std::string ticketText = "";447 uint32 unk1, unk2;448 449 recv_data >> map >> x >> y >> z; // last check 2.4.3450 recv_data >> ticketText;451 452 // recheck453 CHECK_PACKET_SIZE(recv_data,4*4+(ticketText.size()+1)+2*4);454 455 recv_data >> unk1 >> unk2;456 // note: the packet might contain more data, but the exact structure of that is unknown457 458 sLog.outDebug("TicketCreate: map %u, x %f, y %f, z %f, text %s, unk1 %u, unk2 %u", map, x, y, z, ticketText.c_str(), unk1, unk2);459 460 CharacterDatabase.escape_string(ticketText);461 462 QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM character_ticket WHERE guid = '%u'", _player->GetGUIDLow());463 464 if (result)465 {466 int cnt;467 Field *fields = result->Fetch();468 cnt = fields[0].GetUInt32();469 delete result;470 471 if ( cnt > 0 )472 {473 WorldPacket data( SMSG_GMTICKET_CREATE, 4 );474 data << uint32(1);475 SendPacket( &data );476 }477 else478 {479 CharacterDatabase.PExecute("INSERT INTO character_ticket (guid,ticket_text) VALUES ('%u', '%s')", _player->GetGUIDLow(), ticketText.c_str());480 481 WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 );482 data << (uint32)time(NULL);483 data << (uint32)0;484 SendPacket( &data );485 486 data.Initialize( SMSG_GMTICKET_CREATE, 4 );487 data << uint32(2);488 SendPacket( &data );489 DEBUG_LOG("update the ticket\n");490 491 //TODO: Guard player map492 HashMapHolder<Player>::MapType &m = ObjectAccessor::Instance().GetPlayers();493 for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)494 {495 if(itr->second->GetSession()->GetSecurity() >= SEC_GAMEMASTER && itr->second->isAcceptTickets())496 ChatHandler(itr->second).PSendSysMessage(LANG_COMMAND_TICKETNEW,GetPlayer()->GetName());497 }498 }499 }500 }501 502 void WorldSession::HandleGMTicketSystemStatusOpcode( WorldPacket & /*recv_data*/ )503 {504 WorldPacket data( SMSG_GMTICKET_SYSTEMSTATUS,4 );505 data << uint32(1); // we can also disable ticket system by sending 0 value506 507 SendPacket( &data );508 }509 510 void WorldSession::HandleGMSurveySubmit( WorldPacket & recv_data)511 {512 // GM survey is shown after SMSG_GM_TICKET_STATUS_UPDATE with status = 3513 CHECK_PACKET_SIZE(recv_data,4+4);514 uint32 x;515 recv_data >> x; // answer range? (6 = 0-5?)516 sLog.outDebug("SURVEY: X = %u", x);517 518 uint8 result[10];519 memset(result, 0, sizeof(result));520 for( int i = 0; i < 10; ++i)521 {522 CHECK_PACKET_SIZE(recv_data,recv_data.rpos()+4);523 uint32 questionID;524 recv_data >> questionID; // GMSurveyQuestions.dbc525 if (!questionID)526 break;527 528 CHECK_PACKET_SIZE(recv_data,recv_data.rpos()+1+1);529 uint8 value;530 std::string unk_text;531 recv_data >> value; // answer532 recv_data >> unk_text; // always empty?533 534 result[i] = value;535 sLog.outDebug("SURVEY: ID %u, value %u, text %s", questionID, value, unk_text.c_str());536 }537 538 CHECK_PACKET_SIZE(recv_data,recv_data.rpos()+1);539 std::string comment;540 recv_data >> comment; // addional comment541 sLog.outDebug("SURVEY: comment %s", comment.c_str());542 543 // TODO: chart this data in some way544 }545 546 363 void WorldSession::HandleTogglePvP( WorldPacket & recv_data ) 547 364 { -
trunk/src/game/Object.h
r206 r207 34 34 35 35 #define CONTACT_DISTANCE 0.5f 36 #define INTERACTION_DISTANCE 5 37 #define ATTACK_DISTANCE 5 38 #define DETECT_DISTANCE 20 // max distance to successful detect stealthed unit 36 #define INTERACTION_DISTANCE 5.0f 37 #define ATTACK_DISTANCE 5.0f 39 38 #define MAX_VISIBILITY_DISTANCE (5*SIZE_OF_GRID_CELL/2.0f) // max distance for visible object show, limited by active zone for player based at cell size (active zone = 5x5 cells) 40 39 #define DEFAULT_VISIBILITY_DISTANCE (SIZE_OF_GRID_CELL) // default visible distance -
trunk/src/game/ObjectMgr.cpp
r173 r207 3901 3901 if(float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE) 3902 3902 { 3903 sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",tablename,tmp.datalong2,tmp.id); 3903 sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", 3904 tablename,tmp.datalong2,tmp.id); 3904 3905 continue; 3905 3906 } … … 3907 3908 if(tmp.datalong2 && float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE) 3908 3909 { 3909 sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %u or 0 for disable distance check",tablename,tmp.datalong2,tmp.id,uint32(DEFAULT_VISIBILITY_DISTANCE)); 3910 sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check", 3911 tablename,tmp.datalong2,tmp.id,DEFAULT_VISIBILITY_DISTANCE); 3910 3912 continue; 3911 3913 } … … 3913 3915 if(tmp.datalong2 && float(tmp.datalong2) < INTERACTION_DISTANCE) 3914 3916 { 3915 sLog.outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %u or 0 for disable distance check",tablename,tmp.datalong2,tmp.id,uint32(INTERACTION_DISTANCE)); 3917 sLog.outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check", 3918 tablename,tmp.datalong2,tmp.id,INTERACTION_DISTANCE); 3916 3919 continue; 3917 3920 } … … 3925 3928 if(!sSpellStore.LookupEntry(tmp.datalong)) 3926 3929 { 3927 sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",tablename,tmp.datalong,tmp.id); 3930 sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u", 3931 tablename,tmp.datalong,tmp.id); 3928 3932 continue; 3929 3933 } -
trunk/src/game/Pet.cpp
r205 r207 936 936 if(!IsPositionValid()) 937 937 { 938 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %d Y: ^%d)", GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); 938 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", 939 GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); 939 940 return false; 940 941 } -
trunk/src/game/PetitionsHandler.cpp
r102 r207 836 836 { 837 837 Field* fields = result->Fetch(); 838 sLog.outDebug("PetitionsHandler: adding arena member %u", fields[0].GetUInt64()); 839 at->AddMember(fields[0].GetUInt64()); 838 uint64 memberGUID = fields[0].GetUInt64(); 839 sLog.outDebug("PetitionsHandler: adding arena member %u", GUID_LOPART(memberGUID)); 840 at->AddMember(memberGUID); 840 841 result->NextRow(); 841 842 } -
trunk/src/game/Player.cpp
r203 r207 4044 4044 if(LostDurability>0) 4045 4045 { 4046 ItemPrototype const *ditemProto = sItemStorage.LookupEntry<ItemPrototype>(item->GetEntry()); 4047 if(!ditemProto) 4048 { 4049 sLog.outError("ERROR: RepairDurability: Unknown item id %u", ditemProto); 4050 return TotalCost; 4051 } 4046 ItemPrototype const *ditemProto = item->GetProto(); 4052 4047 4053 4048 DurabilityCostsEntry const *dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); 4054 4049 if(!dcost) 4055 4050 { 4056 sLog.outError("ERROR: RepairDurability: Wrong item lvl %u", d cost);4051 sLog.outError("ERROR: RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); 4057 4052 return TotalCost; 4058 4053 } 4059 4054 4060 DurabilityQualityEntry const *dQualitymodEntry = sDurabilityQualityStore.LookupEntry((ditemProto->Quality+1)*2); 4055 uint32 dQualitymodEntryId = (ditemProto->Quality+1)*2; 4056 DurabilityQualityEntry const *dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); 4061 4057 if(!dQualitymodEntry) 4062 4058 { 4063 sLog.outError("ERROR: RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntry );4059 sLog.outError("ERROR: RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); 4064 4060 return TotalCost; 4065 4061 } … … 6157 6153 uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type) 6158 6154 { 6159 QueryResult *result = CharacterDatabase.PQuery("SELECT arenateamid FROM arena_team_member WHERE guid='%u'", GUID_LOPART(guid)); 6160 if(result) 6161 { 6162 bool found = false; 6163 // init id to find the type of the arenateam 6164 uint32 id = (*result)[0].GetUInt32(); 6165 do 6166 { 6167 QueryResult *result2 = CharacterDatabase.PQuery("SELECT type FROM arena_team WHERE arenateamid='%u'", id); 6168 if(result2) 6169 { 6170 uint8 dbtype = (*result2)[0].GetUInt32(); 6171 delete result2; 6172 if(dbtype == type) 6173 { 6174 // if the type matches, we've found the id 6175 found = true; 6176 break; 6177 } 6178 } 6179 } while(result->NextRow()); 6180 delete result; 6181 if(found) return id; 6182 } 6183 // no arenateam for the specified guid, return 0 6184 return 0; 6155 QueryResult *result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u' AND type='%u' LIMIT 1", GUID_LOPART(guid), type); 6156 if(!result) 6157 return 0; 6158 6159 return (*result)[0].GetUInt32(); 6185 6160 } 6186 6161 … … 8573 8548 if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) ) 8574 8549 return true; 8550 return false; 8551 } 8552 8553 bool Player::IsValidPos( uint8 bag, uint8 slot ) 8554 { 8555 // post selected 8556 if(bag == NULL_BAG) 8557 return true; 8558 8559 if (bag == INVENTORY_SLOT_BAG_0) 8560 { 8561 // any post selected 8562 if (slot == NULL_SLOT) 8563 return true; 8564 8565 // equipment 8566 if (slot < EQUIPMENT_SLOT_END) 8567 return true; 8568 8569 // bag equip slots 8570 if (slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END) 8571 return true; 8572 8573 // backpack slots 8574 if (slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_END) 8575 return true; 8576 8577 // keyring slots 8578 if (slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_END) 8579 return true; 8580 8581 // bank main slots 8582 if (slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END) 8583 return true; 8584 8585 // bank bag slots 8586 if (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END) 8587 return true; 8588 8589 return false; 8590 } 8591 8592 // bag content slots 8593 if (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END) 8594 { 8595 Bag* pBag = (Bag*)GetItemByPos (INVENTORY_SLOT_BAG_0, bag); 8596 if(!pBag) 8597 return false; 8598 8599 // any post selected 8600 if (slot == NULL_SLOT) 8601 return true; 8602 8603 return slot < pBag->GetBagSize(); 8604 } 8605 8606 // bank bag content slots 8607 if( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END ) 8608 { 8609 Bag* pBag = (Bag*)GetItemByPos (INVENTORY_SLOT_BAG_0, bag); 8610 if(!pBag) 8611 return false; 8612 8613 // any post selected 8614 if (slot == NULL_SLOT) 8615 return true; 8616 8617 return slot < pBag->GetBagSize(); 8618 } 8619 8620 // where this? 8575 8621 return false; 8576 8622 } -
trunk/src/game/Player.h
r206 r207 1047 1047 static bool IsBankPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); } 1048 1048 static bool IsBankPos( uint8 bag, uint8 slot ); 1049 bool IsValidPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); } 1050 bool IsValidPos( uint8 bag, uint8 slot ); 1049 1051 bool HasBankBagSlot( uint8 slot ) const; 1050 1052 bool HasItemCount( uint32 item, uint32 count, bool inBankAlso = false ) const; -
trunk/src/game/QueryHandler.cpp
r168 r207 203 203 recv_data >> guid; 204 204 205 sLog.outDebug( "WORLD: CMSG_CREATURE_QUERY - (%u) NO CREATURE INFO! (GUID: %u, ENTRY: %u)", uint32(GUID_LOPART(guid)), guid, entry ); 205 sLog.outDebug("WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", 206 GUID_LOPART(guid), entry); 206 207 WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4 ); 207 208 data << uint32(entry | 0x80000000); … … 261 262 recv_data >> guid; 262 263 263 sLog.outDebug( "WORLD: CMSG_GAMEOBJECT_QUERY - (%u) Missing gameobject info for (GUID: %u, ENTRY: %u)", uint32(GUID_LOPART(guid)), guid, entryID ); 264 sLog.outDebug( "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", 265 GUID_LOPART(guid), entryID ); 264 266 WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 4 ); 265 267 data << uint32(entryID | 0x80000000); -
trunk/src/game/QuestHandler.cpp
r168 r207 88 88 recv_data >> guid; 89 89 90 sLog.outDebug ( "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u",guid);90 sLog.outDebug ("WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid)); 91 91 92 92 Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_NONE); 93 93 if (!pCreature) 94 94 { 95 sLog.outDebug( "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); 95 sLog.outDebug ("WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", 96 GUID_LOPART(guid)); 96 97 return; 97 98 } -
trunk/src/game/SpellAuras.cpp
r196 r207 5603 5603 5604 5604 sLog.outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", 5605 G etCasterGUID(), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb);5605 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); 5606 5606 5607 5607 WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size … … 5724 5724 5725 5725 sLog.outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", 5726 G etCasterGUID(), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb);5726 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); 5727 5727 5728 5728 pCaster->SendSpellNonMeleeDamageLog(m_target, GetId(), pdamage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0); -
trunk/src/game/SpellEffects.cpp
r196 r207 1951 1951 if(!spellInfo) 1952 1952 { 1953 sLog.outError("EffectTriggerMissileSpell of spell %u: triggering unknown spell id %effect_idx", m_spellInfo->Id,triggered_spell_id); 1953 sLog.outError("EffectTriggerMissileSpell of spell %u (eff: %u): triggering unknown spell id %u", 1954 m_spellInfo->Id,effect_idx,triggered_spell_id); 1954 1955 return; 1955 1956 } … … 3216 3217 if(!spawnCreature->IsPositionValid()) 3217 3218 { 3218 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %d Y: ^%d)", spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); 3219 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", 3220 spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); 3219 3221 delete spawnCreature; 3220 3222 return; … … 3658 3660 if(!spawnCreature->IsPositionValid()) 3659 3661 { 3660 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %d Y: ^%d)", spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); 3662 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", 3663 spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); 3661 3664 delete spawnCreature; 3662 3665 return; … … 4076 4079 if(!NewSummon->IsPositionValid()) 4077 4080 { 4078 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %d Y: ^%d)", NewSummon->GetGUIDLow(), NewSummon->GetEntry(), NewSummon->GetPositionX(), NewSummon->GetPositionY()); 4081 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", 4082 NewSummon->GetGUIDLow(), NewSummon->GetEntry(), NewSummon->GetPositionX(), NewSummon->GetPositionY()); 4079 4083 delete NewSummon; 4080 4084 return; … … 5674 5678 if(!critter->IsPositionValid()) 5675 5679 { 5676 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %d Y: ^%d)", critter->GetGUIDLow(), critter->GetEntry(), critter->GetPositionX(), critter->GetPositionY()); 5680 sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", 5681 critter->GetGUIDLow(), critter->GetEntry(), critter->GetPositionX(), critter->GetPositionY()); 5677 5682 delete critter; 5678 5683 return; -
trunk/src/game/SpellHandler.cpp
r200 r207 264 264 recv_data >> guid; 265 265 266 sLog.outDebug( "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", guid);266 sLog.outDebug( "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); 267 267 GameObject *obj = ObjectAccessor::GetGameObject(*_player, guid); 268 268 -
trunk/src/game/Transports.cpp
r173 r207 149 149 if(!IsPositionValid()) 150 150 { 151 sLog.outError("ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %d Y: ^%d)",guidlow,x,y); 151 sLog.outError("ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", 152 guidlow,x,y); 152 153 return false; 153 154 } -
trunk/src/game/WaypointManager.cpp
r102 r207 92 92 { 93 93 QueryResult *result1 = WorldDatabase.PQuery("SELECT id, map FROM creature WHERE guid = '%u'", id); 94 if(result1) sLog.outErrorDb("ERROR: Creature (guidlow %d, entry %d) have invalid coordinates in his waypoint %d (X: %d, Y: %d).", id, result1->Fetch()[0].GetUInt32(), point, node.x, node.y); 95 else sLog.outErrorDb("ERROR: Waypoint path %d, have invalid coordinates in his waypoint %d (X: %d, Y: %d).", id, point, node.x, node.y); 94 if(result1) 95 sLog.outErrorDb("ERROR: Creature (guidlow %d, entry %d) have invalid coordinates in his waypoint %d (X: %f, Y: %f).", 96 id, result1->Fetch()[0].GetUInt32(), point, node.x, node.y); 97 else 98 sLog.outErrorDb("ERROR: Waypoint path %d, have invalid coordinates in his waypoint %d (X: %f, Y: %f).", 99 id, point, node.x, node.y); 96 100 97 101 Trinity::NormalizeMapCoord(node.x); -
trunk/src/game/World.cpp
r196 r207 60 60 #include "InstanceSaveMgr.h" 61 61 #include "WaypointManager.h" 62 #include "GMTicketMgr.h" 62 63 #include "Util.h" 63 64 #include "Language.h" … … 461 462 else if(rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > ATTACK_DISTANCE) 462 463 { 463 sLog.outError("TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",rate_values[RATE_TARGET_POS_RECALCULATION_RANGE],ATTACK_DISTANCE,ATTACK_DISTANCE); 464 sLog.outError("TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", 465 rate_values[RATE_TARGET_POS_RECALCULATION_RANGE],ATTACK_DISTANCE,ATTACK_DISTANCE); 464 466 rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = ATTACK_DISTANCE; 465 467 } … … 1175 1177 WaypointMgr.Load(); 1176 1178 1179 sLog.outString( "Loading GM tickets..."); 1180 ticketmgr.LoadGMTickets(); 1181 1177 1182 ///- Handle outdated emails (delete/return) 1178 1183 sLog.outString( "Returning old mails..." ); … … 1204 1209 local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec); 1205 1210 1206 WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', %ld, 0)", isoDate, m_startTime ); 1211 WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', " I64FMTD ", 0)", 1212 isoDate, uint64(m_startTime)); 1207 1213 1208 1214 m_timers[WUPDATE_OBJECTS].SetInterval(0); -
trunk/win/VC71/game.vcproj
r174 r207 627 627 </File> 628 628 <File 629 RelativePath="..\..\src\game\HateMatrix.h">630 </File>631 <File632 629 RelativePath="..\..\src\game\HomeMovementGenerator.cpp"> 633 630 </File> -
trunk/win/VC80/game.vcproj
r174 r207 992 992 </File> 993 993 <File 994 RelativePath="..\..\src\game\HateMatrix.h"995 >996 </File>997 <File998 994 RelativePath="..\..\src\game\HomeMovementGenerator.cpp" 999 995 > -
trunk/win/VC90/game.vcproj
r175 r207 997 997 </File> 998 998 <File 999 RelativePath="..\..\src\game\HateMatrix.h"1000 >1001 </File>1002 <File1003 999 RelativePath="..\..\src\game\HomeMovementGenerator.cpp" 1004 1000 >