Index: ArenaTeam.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/ArenaTeam.cpp,v retrieving revision 1.1 diff -u -r1.1 ArenaTeam.cpp --- ArenaTeam.cpp 24 Feb 2008 21:11:52 -0000 1.1 +++ ArenaTeam.cpp 12 Jan 2008 08:15:44 -0000 @@ -345,7 +345,7 @@ } } session->SendPacket(&data); - sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_ROSTER"); + sLog.outDebug("ArenaTeam348: Sent SMSG_ARENA_TEAM_ROSTER"); } void ArenaTeam::Query(WorldSession *session) @@ -360,7 +360,7 @@ data << BorderColor; // border color? data << BackgroundColor; // background color? session->SendPacket(&data); - sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE"); + sLog.outDebug("ArenaTeam363: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE"); } void ArenaTeam::Stats(WorldSession *session) Index: AuctionHouse.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/AuctionHouse.cpp,v retrieving revision 1.1 diff -u -r1.1 AuctionHouse.cpp --- AuctionHouse.cpp 24 Feb 2008 21:11:52 -0000 1.1 +++ AuctionHouse.cpp 24 Feb 2008 22:27:15 -0000 @@ -76,12 +76,20 @@ //this function inserts to WorldPacket auction's data bool WorldSession::SendAuctionInfo(WorldPacket & data, AuctionEntry* auction) { - Item *pItem = objmgr.GetAItem(auction->item_guid); - if (!pItem) - { - sLog.outError("auction to item, that doesn't exist !!!!"); - return false; - } +//hf002: fix ghost items from apearing on AH.{ + if (!auction->item_guid) return false; + Item *pItem = objmgr.GetAItem(auction->item_guid); + if (!pItem->GetCount()){ + sLog.outError("Error>WorldSession::SendAuctionInfo: auction to item, that doesn't exist !!!!"); + return false; + } + uint32 AHTime = auction->time; + uint32 CurTime = (uint32)time(NULL); + uint32 ExpTime = 86400000; + if(AHTime < CurTime){ + sLog.outError("Error>WorldSession::SendAuctionInfo: Expired auction guid: %u CurTime: %u Auctiontime: %u",auction->item_guid,CurTime,AHTime); + } +//hf002} data << auction->Id; data << pItem->GetUInt32Value(OBJECT_FIELD_ENTRY); @@ -103,7 +111,7 @@ data << (uint32) ((auction->bid)? objmgr.GetAuctionOutBid(auction->bid) : 0); //minimal outbid data << (uint32) auction->buyout; //auction->buyout - data << (uint32) (auction->time - time(NULL)) * 1000; //time left + data << (uint32) ExpTime; //time left data << (uint32) auction->bidder; //auction->bidder current data << (uint32) 0; //player high_guid data << (uint32) auction->bid; //current bid @@ -225,7 +233,8 @@ recv_data >> bid >> buyout >> etime; Player *pl = GetPlayer(); - if (!item || !bid || !etime) +//hf003: + if (!item || !etime) return; //check for cheaters Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, auctioneer,UNIT_NPC_FLAG_AUCTIONEER); @@ -264,7 +273,8 @@ } uint32 location = AuctioneerFactionToLocation(pCreature->getFaction()); - AuctionHouseObject * mAuctions; + sLog.outError("WS::HandleAuctionSellItem Location: %u",location); + AuctionHouseObject * mAuctions; mAuctions = objmgr.GetAuctionsMap( location ); //we have to take deposit : @@ -283,7 +293,14 @@ pl->ModifyMoney( -int32(deposit) ); - AuctionEntry *AH = new AuctionEntry; +//hf003-make auctionhouse add a buyout of bid+deposit+45% to items with no buyout + if (bid < 10) bid = 10; + if(buyout < bid) buyout = deposit + (bid * 1.45); // SantaCL (ensure always a buyout! + + uint32 base = time(NULL); + uint32 AhTime = (etime * 60 * sWorld.getRate(RATE_AUCTION_TIME)) + base; + + AuctionEntry *AH = new AuctionEntry; AH->Id = objmgr.GenerateAuctionID(); AH->auctioneer = GUID_LOPART(auctioneer); AH->item_guid = GUID_LOPART(item); @@ -293,12 +310,12 @@ AH->bidder = 0; AH->bid = 0; AH->buyout = buyout; - time_t base = time(NULL); - AH->time = ((time_t)(etime * 60 * sWorld.getRate(RATE_AUCTION_TIME))) + base; + AH->time = AhTime; //hf002: AH->deposit = deposit; AH->location = location; - sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in minutes) in location: %u", GUID_LOPART(item), GUID_LOPART(auctioneer), bid, buyout, etime, location); + + sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in minutes) in location: %u", GUID_LOPART(item), GUID_LOPART(auctioneer), bid, buyout, etime, AH->location); mAuctions->AddAuction(AH); objmgr.AddAItem(it); @@ -309,10 +326,10 @@ CharacterDatabase.BeginTransaction(); it->DeleteFromInventoryDB(); - it->SaveToDB(); // recursive and not have transaction guard into self + it->SaveToDB(); //hf025: fixed a bug that was corrupting the DB auctionhouse entries. CharacterDatabase.PExecute("INSERT INTO `auctionhouse` (`id`,`auctioneerguid`,`itemguid`,`item_template`,`itemowner`,`buyoutprice`,`time`,`buyguid`,`lastbid`,`startbid`,`deposit`,`location`) " - "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '" I64FMTD "', '%u', '%u', '%u', '%u', '%u')", - AH->Id, AH->auctioneer, AH->item_guid, AH->item_template, AH->owner, AH->buyout, (uint64)AH->time, AH->bidder, AH->bid, AH->startbid, AH->deposit, AH->location); + "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", + AH->Id, AH->auctioneer, AH->item_guid, AH->item_template, AH->owner, AH->buyout, AH->time, AH->bidder, AH->bid, AH->startbid, AH->deposit, AH->location); pl->SaveInventoryAndGoldToDB(); CharacterDatabase.CommitTransaction(); @@ -651,49 +668,56 @@ count = 0; totalcount = 0; data << (uint32) 0; - for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr) - { - AuctionEntry *Aentry = itr->second; - Item *item = objmgr.GetAItem(Aentry->item_guid); - if( item ) - { - ItemPrototype const *proto = item->GetProto(); - if( proto ) + uint8 SubType = NULL; + + //pre-load... + if( auctionMainCategory != (0xffffffff)) SubType = 1; + if( auctionSubCategory != (0xffffffff)) SubType = 2; + if( auctionSlotID != (0xffffffff)) SubType = 3; + std::transform( searchedname.begin(), searchedname.end(), searchedname.begin(), ::tolower ); + + for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr) + { + if (totalcount > 299) break; + AuctionEntry *Aentry = itr->second; + Item *item = objmgr.GetAItem(Aentry->item_guid); + if(!item) continue; + ItemPrototype const *proto = item->GetProto(); + if(!proto) continue; + if (totalcount < listfrom) continue; + + if( auctionMainCategory == (0xffffffff) || proto->Class == auctionMainCategory ) + { + if( auctionSubCategory == (0xffffffff) || proto->SubClass == auctionSubCategory ) + { + if( auctionSlotID == (0xffffffff) || proto->InventoryType == auctionSlotID ) + { + if( quality == (0xffffffff) || proto->Quality == quality ) { - if( auctionMainCategory == (0xffffffff) || proto->Class == auctionMainCategory ) + if( usable == (0x00) || _player->CanUseItem( item ) == EQUIP_ERR_OK ) + { + if( ( levelmin == (0x00) || proto->RequiredLevel >= levelmin ) && ( levelmax == (0x00) || proto->RequiredLevel <= levelmax ) ) { - if( auctionSubCategory == (0xffffffff) || proto->SubClass == auctionSubCategory ) + name = proto->Name1; + std::transform( name.begin(), name.end(), name.begin(), ::tolower ); + std::transform( searchedname.begin(), searchedname.end(), searchedname.begin(), ::tolower ); + if( searchedname.empty() || name.find( searchedname ) != std::string::npos ) + { + if ((count < 50) && (totalcount >= listfrom)) { - if( auctionSlotID == (0xffffffff) || proto->InventoryType == auctionSlotID ) - { - if( quality == (0xffffffff) || proto->Quality == quality ) - { - if( usable == (0x00) || _player->CanUseItem( item ) == EQUIP_ERR_OK ) - { - if( ( levelmin == (0x00) || proto->RequiredLevel >= levelmin ) && ( levelmax == (0x00) || proto->RequiredLevel <= levelmax ) ) - { - name = proto->Name1; - std::transform( name.begin(), name.end(), name.begin(), ::tolower ); - std::transform( searchedname.begin(), searchedname.end(), searchedname.begin(), ::tolower ); - if( searchedname.empty() || name.find( searchedname ) != std::string::npos ) - { - if ((count < 50) && (totalcount >= listfrom)) - { - count++; - SendAuctionInfo( data, Aentry); - } - totalcount++; - } - } - } - } - } + count++; + SendAuctionInfo( data, Aentry); } + } + totalcount++; } + } } + } } - } - data.put(0, count); + } + } + data.put(0, count); data << (uint32) totalcount; SendPacket(&data); -} +} \ No newline at end of file Index: AuctionHouseObject.h =================================================================== RCS file: C:/CVSROOT/final223/src/game/AuctionHouseObject.h,v retrieving revision 1.1 diff -u -r1.1 AuctionHouseObject.h --- AuctionHouseObject.h 24 Feb 2008 21:11:52 -0000 1.1 +++ AuctionHouseObject.h 2 Jan 2008 22:34:39 -0000 @@ -45,7 +45,7 @@ uint32 startbid; //maybe useless uint32 bid; uint32 buyout; - time_t time; + uint32 time;//SantaCl Fixx0r>? uint32 bidder; uint32 deposit; //deposit can be calculated only when creating auction uint32 location; Index: CellImpl.h =================================================================== RCS file: C:/CVSROOT/final223/src/game/CellImpl.h,v retrieving revision 1.1 diff -u -r1.1 CellImpl.h --- CellImpl.h 24 Feb 2008 21:11:52 -0000 1.1 +++ CellImpl.h 20 Jan 2008 18:01:50 -0000 @@ -30,239 +30,192 @@ { CellPair standing_cell = l.i_cellPair; CellPair cell_iter; + if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) return; - if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) - return; - - switch( (district_t)this->data.Part.reserved ) + uint16 CurDistrict = (district_t)this->data.Part.reserved; + if (CurDistrict == CENTER_DISTRICT ){ m.Visit(l, visitor); return;} + + + + switch(CurDistrict) { - case ALL_DISTRICT: - { - CellPair update_cell(standing_cell); - update_cell << 1; - update_cell -= 1; - for(; abs(int(standing_cell.x_coord - update_cell.x_coord)) < 2; update_cell >> 1) - { - for(cell_iter=update_cell; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - - if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - break; - } - case UPPER_LEFT_DISTRICT: - { - CellPair update_cell(standing_cell); - standing_cell << 1; - standing_cell -= 1; - - for(cell_iter = update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter >> 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - - for(cell_iter=update_cell, cell_iter += 1; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - break; - } - case UPPER_RIGHT_DISTRICT: - { - CellPair update_cell(standing_cell); - update_cell >> 1; - update_cell -= 1; - - for(cell_iter = update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter << 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.x_coord == 0) - break; - } - - for(cell_iter=update_cell, cell_iter += 1; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - - break; - } - case LOWER_LEFT_DISTRICT: - { - CellPair update_cell(standing_cell); - update_cell << 1; - update_cell += 1; - - for(cell_iter = update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter >> 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - - for(cell_iter=update_cell, cell_iter -= 1; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter -= 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.y_coord == 0) - break; - } - - break; - } - case LOWER_RIGHT_DISTRICT: - { - CellPair update_cell(standing_cell); - update_cell >> 1; - update_cell += 1; - - for(cell_iter=update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter << 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.x_coord == 0) - break; - } - - for(cell_iter=update_cell, cell_iter -= 1; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter -= 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.y_coord == 0) - break; - } - - break; - } - case LEFT_DISTRICT: - { - CellPair update_cell(standing_cell); - update_cell << 1; - update_cell -= 1; - - for(cell_iter=update_cell; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - - break; - } - case RIGHT_DISTRICT: - { - CellPair update_cell(standing_cell); - update_cell >> 1; - update_cell -= 1; - - for(cell_iter=update_cell; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - break; - } - case UPPER_DISTRICT: - { - CellPair update_cell(standing_cell); - update_cell << 1; - update_cell -= 1; - - for(cell_iter=update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter >> 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - - break; - } - case LOWER_DISTRICT: - { - CellPair update_cell(standing_cell); - update_cell << 1; - update_cell += 1; - - for(cell_iter=update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter >> 1) - { - Cell r_zone = RedZone::GetZone(cell_iter); - r_zone.data.Part.nocreate = l->data.Part.nocreate; - CellLock lock(r_zone, cell_iter); - m.Visit(lock, visitor); - - if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) - break; - } - - break; - } - case CENTER_DISTRICT: - { - m.Visit(l, visitor); - break; - } - default: - { - assert( false ); - break; - } + case ALL_DISTRICT: + { + CellPair update_cell(standing_cell); + update_cell << 1; + update_cell -= 1; + for(; abs(int(standing_cell.x_coord - update_cell.x_coord)) < 2; update_cell >> 1) + { + for(cell_iter=update_cell; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + + if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + } + break; + case UPPER_LEFT_DISTRICT: + { + CellPair update_cell(standing_cell); + standing_cell << 1; + standing_cell -= 1; + for(cell_iter = update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter >> 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + for(cell_iter=update_cell, cell_iter += 1; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + } + break; + case UPPER_RIGHT_DISTRICT: + { + CellPair update_cell(standing_cell); + update_cell >> 1; + update_cell -= 1; + for(cell_iter = update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter << 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.x_coord == 0) break; + } + for(cell_iter=update_cell, cell_iter += 1; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + } + break; + case LOWER_LEFT_DISTRICT: + { + CellPair update_cell(standing_cell); + update_cell << 1; + update_cell += 1; + for(cell_iter = update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter >> 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + for(cell_iter=update_cell, cell_iter -= 1; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter -= 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.y_coord == 0) break; + } + } + break; + case LOWER_RIGHT_DISTRICT: + { + CellPair update_cell(standing_cell); + update_cell >> 1; + update_cell += 1; + for(cell_iter=update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter << 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.x_coord == 0) break; + } + for(cell_iter=update_cell, cell_iter -= 1; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter -= 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.y_coord == 0) break; + } + } + break; + case LEFT_DISTRICT: + { + CellPair update_cell(standing_cell); + update_cell << 1; + update_cell -= 1; + for(cell_iter=update_cell; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + } + break; + case RIGHT_DISTRICT: + { + CellPair update_cell(standing_cell); + update_cell >> 1; + update_cell -= 1; + for(cell_iter=update_cell; abs(int(standing_cell.y_coord - cell_iter.y_coord)) < 2; cell_iter += 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.y_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + } + break; + case UPPER_DISTRICT: + { + CellPair update_cell(standing_cell); + update_cell << 1; + update_cell -= 1; + for(cell_iter=update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter >> 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + } + break; + case LOWER_DISTRICT: + { + CellPair update_cell(standing_cell); + update_cell << 1; + update_cell += 1; + for(cell_iter=update_cell; abs(int(standing_cell.x_coord - cell_iter.x_coord)) < 2; cell_iter >> 1) + { + Cell r_zone = RedZone::GetZone(cell_iter); + r_zone.data.Part.nocreate = l->data.Part.nocreate; + CellLock lock(r_zone, cell_iter); + m.Visit(lock, visitor); + if (cell_iter.x_coord == TOTAL_NUMBER_OF_CELLS_PER_MAP-1) break; + } + } + break; + default: + { + assert( false ); + } + break; } } #endif Index: CharacterHandler.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/CharacterHandler.cpp,v retrieving revision 1.1 diff -u -r1.1 CharacterHandler.cpp --- CharacterHandler.cpp 24 Feb 2008 21:11:52 -0000 1.1 +++ CharacterHandler.cpp 27 Jan 2008 02:19:21 -0000 @@ -383,7 +383,6 @@ Player* pCurrChar = new Player(this); pCurrChar->GetMotionMaster()->Initialize(); - // "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools) if(!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder)) { KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick @@ -393,7 +392,7 @@ return; } else - SetPlayer(pCurrChar); + SetPlayer(pCurrChar); pCurrChar->SendDungeonDifficulty(); @@ -546,33 +545,29 @@ // Place character in world (and load zone) before some object loading pCurrChar->LoadCorpse(); + pCurrChar->SetSpeed(MOVE_WALK, 2.0f, true); + pCurrChar->SetSpeed(MOVE_RUN, 2.0f, true); + pCurrChar->SetSpeed(MOVE_WALKBACK, 2.0f, true); + pCurrChar->SetSpeed(MOVE_SWIM, 2.0f, true); + pCurrChar->SetSpeed(MOVE_SWIMBACK, 2.0f, true); // setting Ghost+speed if dead //if ( pCurrChar->m_deathState == DEAD ) - if (pCurrChar->m_deathState != ALIVE) + int index; + bool AlreadyDead = false; + for (index = 47; index < 104; ++index) + { + //hf018:check auras for deathstate. if present, ensure player is actually dead. + if((pCurrChar->m_uint32Values[index] == 8326) || (pCurrChar->m_uint32Values[index] == 20584)) + { + pCurrChar->m_uint32Values[index] = 0; + AlreadyDead = true; + } + } + + if ((pCurrChar->m_deathState != ALIVE) || AlreadyDead) { - // not blizz like, we must correctly save and load player instead... - if(pCurrChar->getRace() == RACE_NIGHTELF) - pCurrChar->CastSpell(pCurrChar, 20584, true, 0);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form) - pCurrChar->CastSpell(pCurrChar, 8326, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) - - //pCurrChar->SetUInt32Value(UNIT_FIELD_AURA+41, 8326); - //pCurrChar->SetUInt32Value(UNIT_FIELD_AURA+42, 20584); - //pCurrChar->SetUInt32Value(UNIT_FIELD_AURAFLAGS+6, 238); - //pCurrChar->SetUInt32Value(UNIT_FIELD_AURALEVELS+11, 514); - //pCurrChar->SetUInt32Value(UNIT_FIELD_AURAAPPLICATIONS+11, 65535); - //pCurrChar->SetUInt32Value(UNIT_FIELD_DISPLAYID, 1825); - //if (pCurrChar->getRace() == RACE_NIGHTELF) - //{ - // pCurrChar->SetSpeed(MOVE_RUN, 1.5f*1.2f, true); - // pCurrChar->SetSpeed(MOVE_SWIM, 1.5f*1.2f, true); - //} - //else - //{ - // pCurrChar->SetSpeed(MOVE_RUN, 1.5f, true); - // pCurrChar->SetSpeed(MOVE_SWIM, 1.5f, true); - //} - pCurrChar->SetMovement(MOVE_WATER_WALK); + pCurrChar->setDeathState(DEAD); } // Load pet if any and player is alive @@ -604,6 +599,7 @@ m_playerLoading = false; delete holder; + sLog.outError("Player %u loaded. Flags: %u : %u ",pCurrChar->GetGUID(),pCurrChar->GetUInt32Value(UNIT_FIELD_FLAGS),pCurrChar->GetUInt32Value(UNIT_FIELD_FLAGS_2)); } void WorldSession::HandleSetFactionAtWar( WorldPacket & recv_data ) Index: CombatHandler.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/CombatHandler.cpp,v retrieving revision 1.1 diff -u -r1.1 CombatHandler.cpp --- CombatHandler.cpp 24 Feb 2008 21:11:52 -0000 1.1 +++ CombatHandler.cpp 12 Jan 2008 08:15:04 -0000 @@ -40,7 +40,7 @@ if(!pEnemy) { if(GUID_HIPART(guid)!=HIGHGUID_PLAYER && GUID_HIPART(guid)!=HIGHGUID_UNIT) - sLog.outError("WORLD: Object %u (TypeID: %u) isn't player or creature",GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); + sLog.outError("CombatHandler43: Object %u (TypeID: %u) isn't player or creature",GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); else sLog.outError( "WORLD: Enemy %s %u not found",(GUID_HIPART(guid)==HIGHGUID_PLAYER ? "player" : "creature"),GUID_LOPART(guid)); Index: Creature.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/Creature.cpp,v retrieving revision 1.1 diff -u -r1.1 Creature.cpp --- Creature.cpp 24 Feb 2008 21:11:53 -0000 1.1 +++ Creature.cpp 19 Jan 2008 21:20:25 -0000 @@ -126,8 +126,9 @@ continue; } - if(ObjectMgr::IsProfessionSpell(spellinfo->EffectTriggerSpell[0])) - m_trainer_type = 2; +//SantaCl +// if(ObjectMgr::IsProfessionSpell(spellinfo->EffectTriggerSpell[0])) +// m_trainer_type = 2; TrainerSpell tspell; tspell.spell = spellinfo; @@ -425,72 +426,70 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const { - if(!isTrainer()) - return false; - - if(m_trainer_spells.empty()) - { - sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.", - GetGUIDLow(),GetCreatureInfo()->Entry); - return false; - } + if(!isTrainer()) return false; + if(m_trainer_spells.empty()) + { + sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.", + GetGUIDLow(),GetCreatureInfo()->Entry); + return false; + } - return true; +return true;//hf014: switch(GetCreatureInfo()->trainer_type) { - case TRAINER_TYPE_CLASS: - if(pPlayer->getClass()!=GetCreatureInfo()->classNum) - { - if(msg) - { - pPlayer->PlayerTalkClass->ClearMenus(); - switch(GetCreatureInfo()->classNum) - { - case CLASS_DRUID: pPlayer->PlayerTalkClass->SendGossipMenu( 4913,GetGUID()); break; - case CLASS_HUNTER: pPlayer->PlayerTalkClass->SendGossipMenu(10090,GetGUID()); break; - case CLASS_MAGE: pPlayer->PlayerTalkClass->SendGossipMenu( 328,GetGUID()); break; - case CLASS_PALADIN:pPlayer->PlayerTalkClass->SendGossipMenu( 1635,GetGUID()); break; - case CLASS_PRIEST: pPlayer->PlayerTalkClass->SendGossipMenu( 4436,GetGUID()); break; - case CLASS_ROGUE: pPlayer->PlayerTalkClass->SendGossipMenu( 4797,GetGUID()); break; - case CLASS_SHAMAN: pPlayer->PlayerTalkClass->SendGossipMenu( 5003,GetGUID()); break; - case CLASS_WARLOCK:pPlayer->PlayerTalkClass->SendGossipMenu( 5836,GetGUID()); break; - case CLASS_WARRIOR:pPlayer->PlayerTalkClass->SendGossipMenu( 4985,GetGUID()); break; - } - } - return false; - } - break; - case TRAINER_TYPE_PETS: - if(pPlayer->getClass()!=CLASS_HUNTER) - { - pPlayer->PlayerTalkClass->ClearMenus(); - pPlayer->PlayerTalkClass->SendGossipMenu(3620,GetGUID()); - return false; - } - break; - case TRAINER_TYPE_MOUNTS: - if(GetCreatureInfo()->race && pPlayer->getRace() != GetCreatureInfo()->race) - { - if(msg) - { - pPlayer->PlayerTalkClass->ClearMenus(); - switch(GetCreatureInfo()->classNum) - { - case RACE_DWARF: pPlayer->PlayerTalkClass->SendGossipMenu(5865,GetGUID()); break; - case RACE_GNOME: pPlayer->PlayerTalkClass->SendGossipMenu(4881,GetGUID()); break; - case RACE_HUMAN: pPlayer->PlayerTalkClass->SendGossipMenu(5861,GetGUID()); break; - case RACE_NIGHTELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862,GetGUID()); break; - case RACE_ORC: pPlayer->PlayerTalkClass->SendGossipMenu(5863,GetGUID()); break; - case RACE_TAUREN: pPlayer->PlayerTalkClass->SendGossipMenu(5864,GetGUID()); break; - case RACE_TROLL: pPlayer->PlayerTalkClass->SendGossipMenu(5816,GetGUID()); break; - case RACE_UNDEAD_PLAYER:pPlayer->PlayerTalkClass->SendGossipMenu( 624,GetGUID()); break; - case RACE_BLOODELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862,GetGUID()); break; - case RACE_DRAENEI: pPlayer->PlayerTalkClass->SendGossipMenu(5864,GetGUID()); break; - } - } - return false; - } - break; +// case TRAINER_TYPE_CLASS: +// if(pPlayer->getClass()!=GetCreatureInfo()->classNum) +// { +// if(msg) +// { +// pPlayer->PlayerTalkClass->ClearMenus(); +// switch(GetCreatureInfo()->classNum) +// { +// case CLASS_DRUID: pPlayer->PlayerTalkClass->SendGossipMenu( 4913,GetGUID()); break; +// case CLASS_HUNTER: pPlayer->PlayerTalkClass->SendGossipMenu(10090,GetGUID()); break; +// case CLASS_MAGE: pPlayer->PlayerTalkClass->SendGossipMenu( 328,GetGUID()); break; +// case CLASS_PALADIN:pPlayer->PlayerTalkClass->SendGossipMenu( 1635,GetGUID()); break; +// case CLASS_PRIEST: pPlayer->PlayerTalkClass->SendGossipMenu( 4436,GetGUID()); break; +// case CLASS_ROGUE: pPlayer->PlayerTalkClass->SendGossipMenu( 4797,GetGUID()); break; +// case CLASS_SHAMAN: pPlayer->PlayerTalkClass->SendGossipMenu( 5003,GetGUID()); break; +// case CLASS_WARLOCK:pPlayer->PlayerTalkClass->SendGossipMenu( 5836,GetGUID()); break; +// case CLASS_WARRIOR:pPlayer->PlayerTalkClass->SendGossipMenu( 4985,GetGUID()); break; +// } +// } +// return false; +// } +// break; +// case TRAINER_TYPE_PETS: +// if(pPlayer->getClass()!=CLASS_HUNTER) +// { +// pPlayer->PlayerTalkClass->ClearMenus(); +// pPlayer->PlayerTalkClass->SendGossipMenu(3620,GetGUID()); +// return false; +// } +// break; +// case TRAINER_TYPE_MOUNTS: +// if(GetCreatureInfo()->race && pPlayer->getRace() != GetCreatureInfo()->race) +// { +// if(msg) +// { +// pPlayer->PlayerTalkClass->ClearMenus(); +// switch(GetCreatureInfo()->classNum) +// { +// case RACE_DWARF: pPlayer->PlayerTalkClass->SendGossipMenu(5865,GetGUID()); break; +// case RACE_GNOME: pPlayer->PlayerTalkClass->SendGossipMenu(4881,GetGUID()); break; +// case RACE_HUMAN: pPlayer->PlayerTalkClass->SendGossipMenu(5861,GetGUID()); break; +// case RACE_NIGHTELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862,GetGUID()); break; +// case RACE_ORC: pPlayer->PlayerTalkClass->SendGossipMenu(5863,GetGUID()); break; +// case RACE_TAUREN: pPlayer->PlayerTalkClass->SendGossipMenu(5864,GetGUID()); break; +// case RACE_TROLL: pPlayer->PlayerTalkClass->SendGossipMenu(5816,GetGUID()); break; +// case RACE_UNDEAD_PLAYER:pPlayer->PlayerTalkClass->SendGossipMenu( 624,GetGUID()); break; +// case RACE_BLOODELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862,GetGUID()); break; +// case RACE_DRAENEI: pPlayer->PlayerTalkClass->SendGossipMenu(5864,GetGUID()); break; + // } + // } + // return false; + // } + // break; case TRAINER_TYPE_TRADESKILLS: if(GetCreatureInfo()->trainer_spell && !pPlayer->HasSpell(GetCreatureInfo()->trainer_spell)) { @@ -540,8 +539,7 @@ bool Creature::isCanTrainingAndResetTalentsOf(Player* pPlayer) const { return pPlayer->getLevel() >= 10 - && GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS - && pPlayer->getClass() == GetCreatureInfo()->classNum; + && GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS; } void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) @@ -608,7 +606,7 @@ cantalking=false; break; case GOSSIP_OPTION_UNLEARNPETSKILLS: - if(!pPlayer->GetPet() || pPlayer->GetPet()->getPetType() != HUNTER_PET || pPlayer->GetPet()->m_spells.size() <= 1 || GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || GetCreatureInfo()->classNum != CLASS_HUNTER) + if(!pPlayer->GetPet() || pPlayer->GetPet()->getPetType() != HUNTER_PET || pPlayer->GetPet()->m_spells.size() <= 1 || GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS ) cantalking=false; break; case GOSSIP_OPTION_TAXIVENDOR: @@ -1307,7 +1305,7 @@ m_respawnDelay = data->spawntimesecs; m_deathState = (DeathState)data->deathState; - if(m_deathState == JUST_DIED) // Don't must be set to JUST_DEAD, see Creature::setDeathState JUST_DIED -> CORPSE promoting. + if(m_deathState == JUST_DIED) // Don't must be set to JUST_DEAD, see Creature::setDeathState JUST_DIED -> CORPSE promoting. { sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_DEAD (1). State set to ALIVE.",GetGUIDLow(),GetEntry()); m_deathState = ALIVE; @@ -1563,7 +1561,7 @@ SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i] ); if(!spellInfo) { - sLog.outError("WORLD: unknown spell id %i\n", m_spells[i]); + sLog.outError("Creature: unknown spell id %i\n", m_spells[i]); continue; } @@ -1611,7 +1609,7 @@ SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i] ); if(!spellInfo) { - sLog.outError("WORLD: unknown spell id %i\n", m_spells[i]); + sLog.outError("Creature: unknown spell id %i\n", m_spells[i]); continue; } @@ -1646,12 +1644,7 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const { // Live player (or with not release body see live creatures or death creatures with corpse disappearing time > 0 - if(pl->isAlive() || pl->GetDeathTimer() > 0) - { - if( GetEntry() == VISUAL_WAYPOINT && !pl->isGameMaster() ) - return false; - return isAlive() || m_deathTimer > 0; - } + if(pl->isAlive() || pl->GetDeathTimer() > 0) return isAlive() || m_deathTimer > 0; // Dead player see live creatures near own corpse if(isAlive()) Index: GameObject.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/GameObject.cpp,v retrieving revision 1.1 diff -u -r1.1 GameObject.cpp --- GameObject.cpp 24 Feb 2008 21:11:53 -0000 1.1 +++ GameObject.cpp 12 Jan 2008 21:49:36 -0000 @@ -552,6 +552,7 @@ bool GameObject::IsTransport() const { + return false; //hf021: turn off transports // If something is marked as a transport, don't transmit an out of range packet for it. GameObjectInfo const * gInfo = GetGOInfo(); if(!gInfo) return false; Index: Item.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/Item.cpp,v retrieving revision 1.1 diff -u -r1.1 Item.cpp --- Item.cpp 24 Feb 2008 21:11:54 -0000 1.1 +++ Item.cpp 22 Feb 2008 02:24:28 -0000 @@ -83,7 +83,7 @@ SpellEntry const *spellInfo = sSpellStore.LookupEntry(set->spells[x]); if(!spellInfo) { - sLog.outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x],setid); + sLog.outError("Item: unknown spell id %u in items set %u effects", set->spells[x],setid); break; } @@ -300,7 +300,9 @@ ItemPrototype const *Item::GetProto() const { - return objmgr.GetItemPrototype(GetUInt32Value(OBJECT_FIELD_ENTRY)); + ItemPrototype const *proto = objmgr.GetItemPrototype(GetUInt32Value(OBJECT_FIELD_ENTRY)); + if(proto->ItemId) return proto; + return false; } Player* Item::GetOwner()const Index: ItemHandler.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/ItemHandler.cpp,v retrieving revision 1.1 diff -u -r1.1 ItemHandler.cpp --- ItemHandler.cpp 24 Feb 2008 21:11:54 -0000 1.1 +++ ItemHandler.cpp 12 Jan 2008 14:48:01 -0000 @@ -187,160 +187,149 @@ // Only _static_ data send in this packet !!! void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4+4+4); - //sLog.outDebug("WORLD: CMSG_ITEM_QUERY_SINGLE"); +// sLog.outDebug("WORLD: CMSG_ITEM_QUERY_SINGLE ItemQuery: %u", item"); + CHECK_PACKET_SIZE(recv_data,4+4+4); uint32 item; recv_data >> item; - - sLog.outDetail("STORAGE: Item Query = %u", item); - ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); - if( pProto ) + if(!pProto ) + { + uint64 guid; + recv_data >> guid; + + sLog.outError( "ItemHandler201: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), item ); + WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); + data << uint32(item | 0x80000000); + SendPacket( &data ); + return; + } + std::string Name = pProto->Name1; + std::string Description = pProto->Description; + int loc_idx = GetSessionLocaleIndex(); + if ( loc_idx >= 0 ) { - std::string Name = pProto->Name1; - std::string Description = pProto->Description; - - int loc_idx = GetSessionLocaleIndex(); - if ( loc_idx >= 0 ) - { - ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); - if (il) - { - if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty()) - Name = il->Name[loc_idx]; - if (il->Description.size() > loc_idx && !il->Description[loc_idx].empty()) - Description = il->Description[loc_idx]; - } - } - // guess size - WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600); - data << pProto->ItemId; - data << pProto->Class; - data << pProto->SubClass; - data << uint32(-1); // new 2.0.3, not exist in wdb cache? - data << Name; - data << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name... - data << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00); - data << uint8(0x00); //pProto->Name4; // blizz not send name there, just uint8(0x00); - data << pProto->DisplayInfoID; - data << pProto->Quality; - data << pProto->Flags; - data << pProto->BuyPrice; - data << pProto->SellPrice; - data << pProto->InventoryType; - data << pProto->AllowableClass; - data << pProto->AllowableRace; - data << pProto->ItemLevel; - data << pProto->RequiredLevel; - data << pProto->RequiredSkill; - data << pProto->RequiredSkillRank; - data << pProto->RequiredSpell; - data << pProto->RequiredHonorRank; - data << pProto->RequiredCityRank; - data << pProto->RequiredReputationFaction; - data << pProto->RequiredReputationRank; - data << pProto->MaxCount; - data << pProto->Stackable; - data << pProto->ContainerSlots; - for(int i = 0; i < 10; i++) - { - data << pProto->ItemStat[i].ItemStatType; - data << pProto->ItemStat[i].ItemStatValue; - } - for(int i = 0; i < 5; i++) - { - data << pProto->Damage[i].DamageMin; - data << pProto->Damage[i].DamageMax; - data << pProto->Damage[i].DamageType; - } - data << pProto->Armor; - data << pProto->HolyRes; - data << pProto->FireRes; - data << pProto->NatureRes; - data << pProto->FrostRes; - data << pProto->ShadowRes; - data << pProto->ArcaneRes; - data << pProto->Delay; - data << pProto->Ammo_type; - - data << (float)pProto->RangedModRange; - for(int s = 0; s < 5; s++) + ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); + if (il) + { + if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty()) Name = il->Name[loc_idx]; + if (il->Description.size() > loc_idx && !il->Description[loc_idx].empty()) Description = il->Description[loc_idx]; + } + } + // guess size + WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600); + data << pProto->ItemId; + data << pProto->Class; + data << pProto->SubClass; + data << uint32(-1); // new 2.0.3, not exist in wdb cache? + data << Name; + data << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name... + data << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00); + data << uint8(0x00); //pProto->Name4; // blizz not send name there, just uint8(0x00); + data << pProto->DisplayInfoID; + data << pProto->Quality; + data << pProto->Flags; + data << pProto->BuyPrice; + data << pProto->SellPrice; + data << pProto->InventoryType; + data << pProto->AllowableClass; + data << pProto->AllowableRace; + data << pProto->ItemLevel; + data << pProto->RequiredLevel; + data << pProto->RequiredSkill; + data << pProto->RequiredSkillRank; + data << pProto->RequiredSpell; + data << pProto->RequiredHonorRank; + data << pProto->RequiredCityRank; + data << pProto->RequiredReputationFaction; + data << pProto->RequiredReputationRank; + data << pProto->MaxCount; + data << pProto->Stackable; + data << pProto->ContainerSlots; + for(int i = 0; i < 10; i++) + { + data << pProto->ItemStat[i].ItemStatType; + data << pProto->ItemStat[i].ItemStatValue; + } + for(int i = 0; i < 5; i++) + { + data << pProto->Damage[i].DamageMin; + data << pProto->Damage[i].DamageMax; + data << pProto->Damage[i].DamageType; + } + data << pProto->Armor; + data << pProto->HolyRes; + data << pProto->FireRes; + data << pProto->NatureRes; + data << pProto->FrostRes; + data << pProto->ShadowRes; + data << pProto->ArcaneRes; + data << pProto->Delay; + data << pProto->Ammo_type; + data << (float)pProto->RangedModRange; + for(int s = 0; s < 5; s++) + { + // send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown + // use `item_template` or if not set then only use spell cooldowns + SpellEntry const* spell = sSpellStore.LookupEntry(pProto->Spells[s].SpellId); + if(spell) + { + bool db_data = pProto->Spells[s].SpellCooldown > 0 || pProto->Spells[s].SpellCategoryCooldown > 0; + data << pProto->Spells[s].SpellId; + data << pProto->Spells[s].SpellTrigger; + data << uint32(-abs(pProto->Spells[s].SpellCharges)); + if(db_data) { - // send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown - // use `item_template` or if not set then only use spell cooldowns - SpellEntry const* spell = sSpellStore.LookupEntry(pProto->Spells[s].SpellId); - if(spell) - { - bool db_data = pProto->Spells[s].SpellCooldown > 0 || pProto->Spells[s].SpellCategoryCooldown > 0; - - data << pProto->Spells[s].SpellId; - data << pProto->Spells[s].SpellTrigger; - data << uint32(-abs(pProto->Spells[s].SpellCharges)); - - if(db_data) - { - data << uint32(pProto->Spells[s].SpellCooldown); - data << uint32(pProto->Spells[s].SpellCategory); - data << uint32(pProto->Spells[s].SpellCategoryCooldown); - } - else - { - data << uint32(spell->RecoveryTime); - data << uint32(spell->Category); - data << uint32(spell->CategoryRecoveryTime); - } - } - else - { - data << uint32(0); - data << uint32(0); - data << uint32(0); - data << uint32(-1); - data << uint32(0); - data << uint32(-1); - } + data << uint32(pProto->Spells[s].SpellCooldown); + data << uint32(pProto->Spells[s].SpellCategory); + data << uint32(pProto->Spells[s].SpellCategoryCooldown); } - data << pProto->Bonding; - data << Description; - data << pProto->PageText; - data << pProto->LanguageID; - data << pProto->PageMaterial; - data << pProto->StartQuest; - data << pProto->LockID; - data << pProto->Material; - data << pProto->Sheath; - data << pProto->RandomProperty; - data << pProto->RandomSuffix; - data << pProto->Block; - data << pProto->ItemSet; - data << pProto->MaxDurability; - data << pProto->Area; - data << pProto->Map; // Added in 1.12.x & 2.0.1 client branch - data << pProto->BagFamily; - data << pProto->TotemCategory; - for(int s = 0; s < 3; s++) + else { - data << pProto->Socket[s].Color; - data << pProto->Socket[s].Content; + data << uint32(spell->RecoveryTime); + data << uint32(spell->Category); + data << uint32(spell->CategoryRecoveryTime); } - data << pProto->socketBonus; - data << pProto->GemProperties; - data << pProto->ExtendedCost; - data << pProto->RequiredDisenchantSkill; - data << pProto->ArmorDamageModifier; - SendPacket( &data ); + } + else + { + data << uint32(0); + data << uint32(0); + data << uint32(0); + data << uint32(-1); + data << uint32(0); + data << uint32(-1); + } } - else + data << pProto->Bonding; + data << Description; + data << pProto->PageText; + data << pProto->LanguageID; + data << pProto->PageMaterial; + data << pProto->StartQuest; + data << pProto->LockID; + data << pProto->Material; + data << pProto->Sheath; + data << pProto->RandomProperty; + data << pProto->RandomSuffix; + data << pProto->Block; + data << pProto->ItemSet; + data << pProto->MaxDurability; + data << pProto->Area; + data << pProto->Map; // Added in 1.12.x & 2.0.1 client branch + data << pProto->BagFamily; + data << pProto->TotemCategory; + for(int s = 0; s < 3; s++) { - uint64 guid; - recv_data >> guid; - - sLog.outDetail( "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), item ); - WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); - data << uint32(item | 0x80000000); - SendPacket( &data ); + data << pProto->Socket[s].Color; + data << pProto->Socket[s].Content; } + data << pProto->socketBonus; + data << pProto->GemProperties; + data << pProto->ExtendedCost; + data << pProto->RequiredDisenchantSkill; + data << pProto->ArmorDamageModifier; + SendPacket( &data ); } void WorldSession::HandleReadItem( WorldPacket & recv_data ) Index: Level0.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/Level0.cpp,v retrieving revision 1.1 diff -u -r1.1 Level0.cpp --- Level0.cpp 24 Feb 2008 21:11:54 -0000 1.1 +++ Level0.cpp 20 Feb 2008 01:27:40 -0000 @@ -189,23 +189,19 @@ bool ChatHandler::HandleSaveCommand(const char* args) { - Player *player=m_session->GetPlayer(); - - // save GM account without delay and output message (testing, etc) - if(m_session->GetSecurity()) - { - player->SaveToDB(); - SendSysMessage(LANG_PLAYER_SAVED); - return true; - } - - // save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning - uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE); - if(save_interval==0 || save_interval > 20*1000 && player->GetSaveTimer() <= save_interval - 20*1000) - player->SaveToDB(); - - return true; + Player *player=m_session->GetPlayer(); + player->SaveToDB(); + SendSysMessage(LANG_PLAYER_SAVED); + return true; } +// +// // save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning +// uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE); +// if(save_interval==0 || save_interval > 20*1000 && player->GetSaveTimer() <= save_interval - 20*1000) +// player->SaveToDB(); +// +// return true; +//} bool ChatHandler::HandleGMListCommand(const char* args) { Index: Level1.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/Level1.cpp,v retrieving revision 1.1 diff -u -r1.1 Level1.cpp --- Level1.cpp 24 Feb 2008 21:11:54 -0000 1.1 +++ Level1.cpp 20 Feb 2008 02:21:40 -0000 @@ -308,11 +308,11 @@ chr->GetSession()->SendPacket( &data ); } - chr->SaveRecallPosition(); // before GM float x,y,z; m_session->GetPlayer()->GetClosePoint(x,y,z,chr->GetObjectSize()); + chr->SaveRecallPosition(); chr->TeleportTo(m_session->GetPlayer()->GetMapId(),x,y,z,chr->GetOrientation()); } else if (uint64 guid = objmgr.GetPlayerGUIDByName(name)) @@ -408,12 +408,12 @@ chr->GetSession()->SendPacket(&data); } - _player->SaveRecallPosition(); // to point to see at target with same orientation float x,y,z; chr->GetContactPoint(m_session->GetPlayer(),x,y,z); + _player->SaveRecallPosition(); _player->TeleportTo(chr->GetMapId(), x, y, z, _player->GetAngle( chr ), true, true, true); return true; } @@ -439,54 +439,22 @@ } // Teleport player to last position -bool ChatHandler::HandleRecallCommand(const char* args) -{ - Player* chr = NULL; - - if(!*args) - { - chr = getSelectedPlayer(); - - if(!chr) - { - chr = m_session->GetPlayer(); - - if(chr->isInFlight()) - { - SendSysMessage(LANG_TARGET_IN_FLIGHT); - return true; - } - } - } - else - { - std::string name = args; - normalizePlayerName(name); - //WorldDatabase.escape_string(name); // prevent SQL injection - normal name don't must changed by this call - - chr = objmgr.GetPlayer(name.c_str()); - - if(!chr) - { - PSendSysMessage(LANG_NO_PLAYER, args); - return true; - } - } - - if(chr->IsBeingTeleported()) - { - PSendSysMessage(LANG_IS_TELEPORTED, chr->GetName()); - return true; - } - - if(chr->isInFlight()) - { - PSendSysMessage(LANG_CHAR_IN_FLIGHT, chr->GetName()); - return true; - } - - chr->TeleportTo(chr->m_recallMap, chr->m_recallX, chr->m_recallY, chr->m_recallZ, chr->m_recallO); - return true; +bool ChatHandler::HandleRecallCommand(const char* args){ + Player* chr = NULL; + //hf001 start: + chr = m_session->GetPlayer(); + + if(chr->isInFlight()){ + SendSysMessage(LANG_TARGET_IN_FLIGHT); + return true; + } + if(chr->IsBeingTeleported()){ + PSendSysMessage(LANG_IS_TELEPORTED, chr->GetName()); + return true; + } + chr->TeleportTo(chr->m_recallMap, chr->m_recallX, chr->m_recallY, chr->m_recallZ, chr->m_recallO); + return true; + //hf001 end } //Edit Player KnownTitles @@ -908,29 +876,19 @@ //Edit Player Aspeed bool ChatHandler::HandleModifyASpeedCommand(const char* args) { - if (!*args) - return false; + if (!*args) return false; + float ASpeed = (float)atof((char*)args); + if (ASpeed > 20) ASpeed = 20; + if (ASpeed < 0.5) ASpeed = 0.5; - float ASpeed = (float)atof((char*)args); - if (ASpeed > 10 || ASpeed < 0.1) - { - SendSysMessage(LANG_BAD_VALUE); - return true; - } - - Player *chr = getSelectedPlayer(); - if (chr == NULL) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - return true; - } - - if(chr->isInFlight()) - { - PSendSysMessage(LANG_CHAR_IN_FLIGHT,chr->GetName()); - return true; - } + Player *chr = m_session->GetPlayer(); + +// if(chr->isInFlight()) +// { +// PSendSysMessage(LANG_CHAR_IN_FLIGHT,chr->GetName()); +// return true; +// } PSendSysMessage(LANG_YOU_CHANGE_ASPEED, ASpeed, chr->GetName()); @@ -1113,24 +1071,14 @@ //Edit Player Scale bool ChatHandler::HandleModifyScaleCommand(const char* args) { - if (!*args) - return false; + if (!*args) return false; + float Scale = (float)atof((char*)args); + if (Scale = 0.0f) Scale = 1.0f; + if (Scale > 2.0f) Scale = 2.0f; + if (Scale < 0.3f) Scale = 0.3f; + Player *chr = m_session->GetPlayer(); - float Scale = (float)atof((char*)args); - if (Scale > 3.0f || Scale <= 0.0f) - { - SendSysMessage(LANG_BAD_VALUE); - return true; - } - - Player *chr = getSelectedPlayer(); - if (chr == NULL) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - return true; - } - - PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, chr->GetName()); + PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, chr->GetName()); WorldPacket data; char buf[256]; @@ -1594,7 +1542,6 @@ } _player->SaveRecallPosition(); - _player->TeleportTo(mapid, x, y, z, ort); return true; } @@ -1870,7 +1817,6 @@ } chr->SaveRecallPosition(); - chr->TeleportTo(mapid,x,y,z,chr->GetOrientation()); } else if (uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str())) Index: Level2.cpp =================================================================== RCS file: C:/CVSROOT/final223/src/game/Level2.cpp,v retrieving revision 1.1 diff -u -r1.1 Level2.cpp --- Level2.cpp 24 Feb 2008 21:11:54 -0000 1.1 +++ Level2.cpp 6 Jan 2008 22:48:23 -0000 @@ -1292,17 +1292,11 @@ //morph creature or player bool ChatHandler::HandleMorphCommand(const char* args) { - if (!*args) - return false; - - uint16 display_id = (uint16)atoi((char*)args); - - Unit *target = getSelectedUnit(); - if(!target) - target = m_session->GetPlayer(); -