Changeset 177
- Timestamp:
- 11/19/08 13:43:30 (17 years ago)
- Location:
- trunk
- Files:
-
- 20 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/contrib/extractor/System.cpp
r2 r177 40 40 int extract = EXTRACT_MAP | EXTRACT_DBC; 41 41 42 static char* const langs[]={" deDE", "enGB", "enUS", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" };42 static char* const langs[]={"enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" }; 43 43 #define LANG_COUNT 12 44 44 … … 168 168 CreateDir(path); 169 169 170 for( int x = 0; x < ADT_RES; ++x)171 { 172 for( int y = 0; y < ADT_RES; ++y)173 { 174 for( int z = 0; z < map_count; ++z)170 for(unsigned int x = 0; x < ADT_RES; ++x) 171 { 172 for(unsigned int y = 0; y < ADT_RES; ++y) 173 { 174 for(unsigned int z = 0; z < map_count; ++z) 175 175 { 176 176 sprintf(mpq_filename,"World\\Maps\\%s\\%s_%u_%u.adt",map_ids[z].name,map_ids[z].name,x,y); … … 190 190 //bool WMO(char* filename); 191 191 192 void ExtractDBCFiles( )192 void ExtractDBCFiles(int locale, bool basicLocale) 193 193 { 194 194 printf("Extracting dbc files...\n"); … … 199 199 for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end();++i) 200 200 { 201 vector<string> files = (*i)->GetFileList(); 201 vector<string> files; 202 (*i)->GetFileListTo(files); 202 203 for (vector<string>::iterator iter = files.begin(); iter != files.end(); ++iter) 203 204 if (iter->rfind(".dbc") == iter->length() - strlen(".dbc")) … … 205 206 } 206 207 207 st d::string path = output_path;208 string path = output_path; 208 209 path += "/dbc/"; 209 210 CreateDir(path); 211 if(!basicLocale) 212 { 213 path += langs[locale]; 214 path += "/"; 215 CreateDir(path); 216 } 210 217 211 218 // extract DBCs … … 213 220 for (set<string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter) 214 221 { 215 string filename = output_path; 216 filename += "/dbc/"; 222 string filename = path; 217 223 filename += (iter->c_str() + strlen("DBFilesClient\\")); 218 219 //cout << filename << endl;220 224 221 225 FILE *output=fopen(filename.c_str(),"wb"); … … 232 236 ++count; 233 237 } 234 printf("Extracted %u DBC files\n", count); 235 } 236 237 int GetLocale() 238 { 238 printf("Extracted %u DBC files\n\n", count); 239 } 240 241 void LoadLocaleMPQFiles(int const locale) 242 { 243 char filename[512]; 244 245 sprintf(filename,"%s/Data/%s/locale-%s.MPQ",input_path,langs[locale],langs[locale]); 246 new MPQArchive(filename); 247 248 for(int i = 1; i < 5; ++i) 249 { 250 char ext[3] = ""; 251 if(i > 1) 252 sprintf(ext, "-%i", i); 253 254 sprintf(filename,"%s/Data/%s/patch-%s%s.MPQ",input_path,langs[locale],langs[locale],ext); 255 if(FileExists(filename)) 256 new MPQArchive(filename); 257 } 258 } 259 260 void LoadCommonMPQFiles() 261 { 262 char filename[512]; 263 264 sprintf(filename,"%s/Data/common.MPQ",input_path); 265 new MPQArchive(filename); 266 sprintf(filename,"%s/Data/expansion.MPQ",input_path); 267 new MPQArchive(filename); 268 for(int i = 1; i < 5; ++i) 269 { 270 char ext[3] = ""; 271 if(i > 1) 272 sprintf(ext, "-%i", i); 273 if(FileExists(filename)) 274 new MPQArchive(filename); 275 } 276 } 277 278 inline void CloseMPQFiles() 279 { 280 for(ArchiveSet::iterator j = gOpenArchives.begin(); j != gOpenArchives.end();++j) (*j)->close(); 281 gOpenArchives.clear(); 282 } 283 284 int main(int argc, char * arg[]) 285 { 286 printf("Map & DBC Extractor\n"); 287 printf("===================\n\n"); 288 289 HandleArgs(argc, arg); 290 291 int FirstLocale = -1; 292 239 293 for (int i = 0; i < LANG_COUNT; i++) 240 294 { … … 244 298 { 245 299 printf("Detected locale: %s\n", langs[i]); 246 return i; 247 } 248 } 249 250 printf("Could not detect locale.\n"); 251 return -1; 252 } 253 254 void LoadMPQFiles(int const locale) 255 { 256 char filename[512]; 257 258 sprintf(filename,"%s/Data/%s/locale-%s.MPQ",input_path,langs[locale],langs[locale]); 259 new MPQArchive(filename); 260 261 for(int i = 1; i < 5; ++i) 262 { 263 char ext[3] = ""; 264 if(i > 1) 265 sprintf(ext, "-%i", i); 266 267 sprintf(filename,"%s/Data/%s/patch-%s%s.MPQ",input_path,langs[locale],langs[locale],ext); 268 if(!FileExists(filename)) 269 break; 270 new MPQArchive(filename); 271 } 272 273 //need those files only if extract maps 274 if(extract & EXTRACT_MAP) 275 { 276 sprintf(filename,"%s/Data/common.MPQ",input_path); 277 new MPQArchive(filename); 278 sprintf(filename,"%s/Data/expansion.MPQ",input_path); 279 new MPQArchive(filename); 280 281 for(int i = 1; i < 5; ++i) 282 { 283 char ext[3] = ""; 284 if(i > 1) 285 sprintf(ext, "-%i", i); 286 287 sprintf(filename,"%s/Data/patch%s.MPQ",input_path,ext); 288 if(!FileExists(filename)) 289 break; 290 new MPQArchive(filename); 291 } 292 } 293 } 294 295 int main(int argc, char * arg[]) 296 { 297 printf("Map & DBC Extractor\n"); 298 printf("===================\n"); 299 300 HandleArgs(argc, arg); 301 302 int const locale = GetLocale(); 303 if(locale < 0) 304 return 1; 305 306 LoadMPQFiles(locale); 307 308 if(extract & EXTRACT_DBC) 309 ExtractDBCFiles(); 310 311 if(extract & EXTRACT_MAP) 300 301 //Open MPQs 302 LoadLocaleMPQFiles(i); 303 304 if((extract & EXTRACT_DBC) == 0) 305 { 306 FirstLocale=i; 307 break; 308 } 309 310 //Extract DBC files 311 if(FirstLocale<0) 312 { 313 ExtractDBCFiles(i, true); 314 FirstLocale = i; 315 } 316 else 317 ExtractDBCFiles(i, false); 318 319 //Close MPQs 320 CloseMPQFiles(); 321 } 322 } 323 324 if(FirstLocale<0) 325 { 326 printf("No locales detected\n"); 327 return 0; 328 } 329 330 if (extract & EXTRACT_MAP) 331 { 332 printf("Using locale: %s\n", langs[FirstLocale]); 333 334 // Open MPQs 335 LoadLocaleMPQFiles(FirstLocale); 336 LoadCommonMPQFiles(); 337 338 // Extract maps 312 339 ExtractMapsFromMpq(); 313 340 314 //Close MPQs 315 for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end();++i) 316 (*i)->close(); 317 gOpenArchives.clear(); 341 // Close MPQs 342 CloseMPQFiles(); 343 } 318 344 319 345 return 0; -
trunk/contrib/extractor/libmpq/mpq.cpp
r168 r177 200 200 * This function returns some useful file information. 201 201 */ 202 int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const int number) {202 int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const int unsigned number) { 203 203 int blockindex = number; //-1; 204 204 int i = 0; -
trunk/contrib/extractor/libmpq/mpq.h
r2 r177 199 199 extern int libmpq_archive_info(mpq_archive *mpq_a, unsigned int infotype); 200 200 //extern int libmpq_file_extract(mpq_archive *mpq_a, const int number); 201 extern int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const int number);201 extern int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const unsigned int number); 202 202 extern char *libmpq_file_name(mpq_archive *mpq_a, const int number); 203 203 extern int libmpq_file_number(mpq_archive *mpq_a, const char *name); -
trunk/contrib/extractor/libmpq/parser.cpp
r2 r177 80 80 81 81 /* now search for comment in this line */ 82 for (i = 0; i < strlen(line); i++) {82 for (i = 0; i < int(strlen(line)); i++) { 83 83 if (line[i] == '#') { 84 84 pos = i - 1; -
trunk/contrib/extractor/mpq_libmpq.cpp
r2 r177 72 72 } 73 73 74 intfileno = blockindex;74 uint32 fileno = blockindex; 75 75 76 76 //int fileno = libmpq_file_number(&mpq_a, filename); -
trunk/contrib/extractor/mpq_libmpq.h
r2 r177 52 52 } 53 53 54 vector<string> GetFileList() { 55 vector<string> filelist; 56 54 void GetFileListTo(vector<string>& filelist) { 57 55 mpq_hash hash = GetHashEntry("(listfile)"); 58 56 uint32 blockindex = hash.blockindex; 59 57 60 58 if ((blockindex == 0xFFFFFFFF) || (blockindex == 0)) 61 return filelist;59 return; 62 60 63 61 uint32 size = libmpq_file_info(&mpq_a, LIBMPQ_FILE_UNCOMPRESSED_SIZE, blockindex); … … 80 78 } 81 79 82 delete buffer; 83 return filelist; 80 delete[] buffer; 84 81 } 85 82 }; -
trunk/src/game/Bag.cpp
r102 r177 40 40 Bag::~Bag() 41 41 { 42 for(int i = 0; i<MAX_BAG_SIZE; i++) 43 { 44 if(m_bagslot[i]) delete m_bagslot[i]; 45 } 42 for(int i = 0; i < MAX_BAG_SIZE; ++i) 43 if (m_bagslot[i]) 44 delete m_bagslot[i]; 46 45 } 47 46 … … 50 49 Item::AddToWorld(); 51 50 52 for(int i = 0; i<MAX_BAG_SIZE; i++) 53 { 51 for(uint32 i = 0; i < GetBagSize(); ++i) 54 52 if(m_bagslot[i]) 55 53 m_bagslot[i]->AddToWorld(); 56 }57 54 } 58 55 59 56 void Bag::RemoveFromWorld() 60 57 { 61 for(int i = 0; i<MAX_BAG_SIZE; i++) 62 { 58 for(uint32 i = 0; i < GetBagSize(); ++i) 63 59 if(m_bagslot[i]) 64 60 m_bagslot[i]->RemoveFromWorld(); 65 }66 61 67 62 Item::RemoveFromWorld(); … … 112 107 113 108 // cleanup bag content related item value fields (its will be filled correctly from `character_inventory`) 114 for ( uint32 i = 0; i < GetProto()->ContainerSlots; i++)109 for (int i = 0; i < MAX_BAG_SIZE; ++i) 115 110 { 116 111 SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0); … … 128 123 { 129 124 for (int i = 0; i < MAX_BAG_SIZE; i++) 130 { 131 if (m_bagslot[i]) 132 { 125 if (m_bagslot[i]) 133 126 m_bagslot[i]->DeleteFromDB(); 134 }135 }136 127 137 128 Item::DeleteFromDB(); … … 140 131 uint32 Bag::GetFreeSlots() const 141 132 { 142 uint32 ContainerSlots=GetProto()->ContainerSlots;143 133 uint32 slots = 0; 144 for (uint 8 i=0; i <ContainerSlots; i++)134 for (uint32 i=0; i < GetBagSize(); i++) 145 135 if (!m_bagslot[i]) 146 136 ++slots; … … 179 169 Item::BuildCreateUpdateBlockForPlayer( data, target ); 180 170 181 for (int i = 0; i < MAX_BAG_SIZE; i++) 182 { 171 for (uint32 i = 0; i < GetBagSize(); ++i) 183 172 if(m_bagslot[i]) 184 173 m_bagslot[i]->BuildCreateUpdateBlockForPlayer( data, target ); 185 }186 174 } 187 175 … … 189 177 bool Bag::IsEmpty() const 190 178 { 191 uint32 ContainerSlots=GetProto()->ContainerSlots;192 for(uint32 i=0; i < ContainerSlots; i++)193 if (m_bagslot[i])return false;179 for(uint32 i = 0; i < GetBagSize(); ++i) 180 if (m_bagslot[i]) 181 return false; 194 182 195 183 return true; … … 198 186 uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const 199 187 { 200 uint32 ContainerSlots=GetProto()->ContainerSlots;201 202 188 Item *pItem; 203 189 uint32 count = 0; 204 for(uint32 i=0; i < ContainerSlots; i++)190 for(uint32 i=0; i < GetBagSize(); ++i) 205 191 { 206 192 pItem = m_bagslot[i]; … … 211 197 if(eItem && eItem->GetProto()->GemProperties) 212 198 { 213 for(uint32 i=0; i < ContainerSlots; i++)199 for(uint32 i=0; i < GetBagSize(); ++i) 214 200 { 215 201 pItem = m_bagslot[i]; … … 224 210 uint8 Bag::GetSlotByItemGUID(uint64 guid) const 225 211 { 226 uint32 ContainerSlots=GetProto()->ContainerSlots; 227 228 for(uint32 i=0;i<ContainerSlots;i++) 229 { 212 for(uint32 i = 0; i < GetBagSize(); ++i) 230 213 if(m_bagslot[i] != 0) 231 214 if(m_bagslot[i]->GetGUID() == guid) 232 215 return i; 233 }234 216 return NULL_SLOT; 235 217 } 236 218 237 // Adds an item to a bag slot238 // - slot can be NULL_SLOT, in that case function searchs for a free slot239 // - Return values: 0 - item not added240 // 1 - item added to a free slot (and perhaps to a stack)241 // 2 - item added to a stack (item should be deleted)242 219 Item* Bag::GetItemByPos( uint8 slot ) const 243 220 { 244 ItemPrototype const *pBagProto = GetProto(); 245 if( pBagProto ) 246 { 247 if( slot < pBagProto->ContainerSlots ) 248 return m_bagslot[slot]; 249 } 221 if( slot < GetBagSize() ) 222 return m_bagslot[slot]; 223 250 224 return NULL; 251 225 } -
trunk/src/game/Bag.h
r102 r177 53 53 bool IsEmpty() const; 54 54 uint32 GetFreeSlots() const; 55 uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); } 55 56 56 57 // DB operations -
trunk/src/game/Chat.cpp
r174 r177 379 379 static ChatCommand npcCommandTable[] = 380 380 { 381 { "say", SEC_MODERATOR, false, &ChatHandler::HandleSayCommand, "", NULL }, 382 { "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL }, 383 { "yell", SEC_MODERATOR, false, &ChatHandler::HandleYellCommand, "", NULL }, 384 { "textemote", SEC_MODERATOR, false, &ChatHandler::HandleTextEmoteCommand, "", NULL }, 385 { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleAddSpwCommand, "", NULL }, 386 { "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleDelCreatureCommand, "", NULL }, 387 { "spawndist", SEC_GAMEMASTER, false, &ChatHandler::HandleSpawnDistCommand, "", NULL }, 388 { "spawntime", SEC_GAMEMASTER, false, &ChatHandler::HandleSpawnTimeCommand, "", NULL }, 389 { "factionid", SEC_GAMEMASTER, false, &ChatHandler::HandleFactionIdCommand, "", NULL }, 390 { "addmove", SEC_GAMEMASTER, false, &ChatHandler::HandleAddMoveCommand, "", NULL }, 391 { "setmovetype", SEC_GAMEMASTER, false, &ChatHandler::HandleSetMoveTypeCommand, "", NULL }, 392 { "move", SEC_GAMEMASTER, false, &ChatHandler::HandleMoveCreatureCommand, "", NULL }, 393 { "changelevel", SEC_GAMEMASTER, false, &ChatHandler::HandleChangeLevelCommand, "", NULL }, 394 { "setmodel", SEC_GAMEMASTER, false, &ChatHandler::HandleSetModelCommand, "", NULL }, 395 { "additem", SEC_GAMEMASTER, false, &ChatHandler::HandleAddVendorItemCommand, "", NULL }, 396 { "delitem", SEC_GAMEMASTER, false, &ChatHandler::HandleDelVendorItemCommand, "", NULL }, 397 { "flag", SEC_GAMEMASTER, false, &ChatHandler::HandleNPCFlagCommand, "", NULL }, 398 { "changeentry", SEC_ADMINISTRATOR, false, &ChatHandler::HandleChangeEntryCommand, "", NULL }, 399 { "info", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcInfoCommand, "", NULL }, 400 { "playemote", SEC_ADMINISTRATOR, false, &ChatHandler::HandlePlayEmoteCommand, "", NULL }, 381 { "say", SEC_MODERATOR, false, &ChatHandler::HandleNpcSayCommand, "", NULL }, 382 { "textemote", SEC_MODERATOR, false, &ChatHandler::HandleNpcTextEmoteCommand, "", NULL }, 383 { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddCommand, "", NULL }, 384 { "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcDeleteCommand, "", NULL }, 385 { "spawndist", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSpawnDistCommand, "", NULL }, 386 { "spawntime", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSpawnTimeCommand, "", NULL }, 387 { "factionid", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFactionIdCommand, "", NULL }, 388 { "addmove", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddMoveCommand, "", NULL }, 389 { "setmovetype", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetMoveTypeCommand, "", NULL }, 390 { "move", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcMoveCommand, "", NULL }, 391 { "changelevel", SEC_GAMEMASTER, false, &ChatHandler::HandleChangeLevelCommand, "", NULL }, 392 { "setmodel", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetModelCommand, "", NULL }, 393 { "additem", SEC_GAMEMASTER, false, &ChatHandler::HandleAddVendorItemCommand, "", NULL }, 394 { "delitem", SEC_GAMEMASTER, false, &ChatHandler::HandleDelVendorItemCommand, "", NULL }, 395 { "flag", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFlagCommand, "", NULL }, 396 { "changeentry", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcChangeEntryCommand, "", NULL }, 397 { "info", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcInfoCommand, "", NULL }, 398 { "playemote", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcPlayEmoteCommand, "", NULL }, 401 399 { "follow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFollowCommand, "", NULL }, 402 400 { "unfollow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcUnFollowCommand, "", NULL }, 401 { "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL }, 402 { "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL }, 403 403 404 404 //{ TODO: fix or remove this commands -
trunk/src/game/Chat.h
r174 r177 118 118 bool HandleTaxiCheatCommand(const char* args); 119 119 bool HandleWhispersCommand(const char* args); 120 bool HandleSayCommand(const char* args);121 bool HandleNpcWhisperCommand(const char* args);122 bool HandleYellCommand(const char* args);123 bool HandlePlayEmoteCommand(const char* args);124 120 bool HandleSendMailCommand(const char* args); 125 121 bool HandleNameTeleCommand(const char* args); … … 131 127 bool HandleEventStopCommand(const char* args); 132 128 bool HandleEventInfoCommand(const char* args); 129 130 bool HandleLearnCommand(const char* args); 131 bool HandleLearnAllCommand(const char* args); 132 bool HandleLearnAllGMCommand(const char* args); 133 bool HandleLearnAllCraftsCommand(const char* args); 134 bool HandleLearnAllRecipesCommand(const char* args); 135 bool HandleLearnAllDefaultCommand(const char* args); 136 bool HandleLearnAllLangCommand(const char* args); 137 bool HandleLearnAllMyClassCommand(const char* args); 138 bool HandleLearnAllMySpellsCommand(const char* args); 139 bool HandleLearnAllMyTalentsCommand(const char* args); 140 141 bool HandleLookupAreaCommand(const char* args); 142 bool HandleLookupCreatureCommand(const char* args); 143 bool HandleLookupEventCommand(const char* args); 144 bool HandleLookupFactionCommand(const char * args); 145 bool HandleLookupItemCommand(const char * args); 146 bool HandleLookupItemSetCommand(const char * args); 147 bool HandleLookupObjectCommand(const char* args); 148 bool HandleLookupPlayerIpCommand(const char* args); 149 bool HandleLookupPlayerAccountCommand(const char* args); 150 bool HandleLookupPlayerEmailCommand(const char* args); 151 bool HandleLookupQuestCommand(const char* args); 152 bool HandleLookupSkillCommand(const char* args); 153 bool HandleLookupSpellCommand(const char* args); 154 bool HandleLookupTeleCommand(const char * args); 133 155 134 156 bool HandleModifyKnownTitlesCommand(const char* args); … … 152 174 bool HandleModifyRepCommand(const char* args); 153 175 bool HandleModifyArenaCommand(const char* args); 154 176 177 bool HandleNpcAddCommand(const char* args); 178 bool HandleNpcAddMoveCommand(const char* args); 179 bool HandleNpcChangeEntryCommand(const char *args); 180 bool HandleNpcDeleteCommand(const char* args); 181 bool HandleNpcFactionIdCommand(const char* args); 182 bool HandleNpcFlagCommand(const char* args); 155 183 bool HandleNpcFollowCommand(const char* args); 184 bool HandleNpcInfoCommand(const char* args); 185 bool HandleNpcMoveCommand(const char* args); 186 bool HandleNpcPlayEmoteCommand(const char* args); 187 bool HandleNpcSayCommand(const char* args); 188 bool HandleNpcSetModelCommand(const char* args); 189 bool HandleNpcSetMoveTypeCommand(const char* args); 190 bool HandleNpcSpawnDistCommand(const char* args); 191 bool HandleNpcSpawnTimeCommand(const char* args); 192 bool HandleNpcTextEmoteCommand(const char* args); 156 193 bool HandleNpcUnFollowCommand(const char* args); 194 bool HandleNpcWhisperCommand(const char* args); 195 bool HandleNpcYellCommand(const char* args); 157 196 158 197 bool HandleReloadCommand(const char* args); … … 250 289 bool HandleSubNameCommand(const char* args); 251 290 bool HandleItemMoveCommand(const char* args); 252 bool HandleDelCreatureCommand(const char* args);253 291 bool HandleDeMorphCommand(const char* args); 254 292 bool HandleAddVendorItemCommand(const char* args); 255 293 bool HandleDelVendorItemCommand(const char* args); 256 bool HandleAddMoveCommand(const char* args);257 bool HandleSetMoveTypeCommand(const char* args);258 294 bool HandleChangeLevelCommand(const char* args); 259 295 bool HandleSetPoiCommand(const char* args); 260 296 bool HandleEquipErrorCommand(const char* args); 261 bool HandleNPCFlagCommand(const char* args);262 bool HandleSetModelCommand(const char* args);263 bool HandleFactionIdCommand(const char* args);264 bool HandleAddSpwCommand(const char* args);265 bool HandleSpawnDistCommand(const char* args);266 bool HandleSpawnTimeCommand(const char* args);267 297 bool HandleGoCreatureCommand(const char* args); 268 298 bool HandleGoObjectCommand(const char* args); … … 271 301 bool HandleTargetObjectCommand(const char* args); 272 302 bool HandleDelObjectCommand(const char* args); 273 bool HandleMoveCreatureCommand(const char* args);274 303 bool HandleMoveObjectCommand(const char* args); 275 304 bool HandleTurnObjectCommand(const char* args); … … 310 339 bool HandleGoCommand(const char* args); 311 340 312 bool HandleLearnCommand(const char* args);313 bool HandleLearnAllCommand(const char* args);314 bool HandleLearnAllGMCommand(const char* args);315 bool HandleLearnAllCraftsCommand(const char* args);316 bool HandleLearnAllRecipesCommand(const char* args);317 bool HandleLearnAllDefaultCommand(const char* args);318 bool HandleLearnAllLangCommand(const char* args);319 bool HandleLearnAllMyClassCommand(const char* args);320 bool HandleLearnAllMySpellsCommand(const char* args);321 bool HandleLearnAllMyTalentsCommand(const char* args);322 323 bool HandleLookupAreaCommand(const char* args);324 bool HandleLookupCreatureCommand(const char* args);325 bool HandleLookupEventCommand(const char* args);326 bool HandleLookupFactionCommand(const char * args);327 bool HandleLookupItemCommand(const char * args);328 bool HandleLookupItemSetCommand(const char * args);329 bool HandleLookupObjectCommand(const char* args);330 bool HandleLookupPlayerIpCommand(const char* args);331 bool HandleLookupPlayerAccountCommand(const char* args);332 bool HandleLookupPlayerEmailCommand(const char* args);333 bool HandleLookupQuestCommand(const char* args);334 bool HandleLookupSkillCommand(const char* args);335 bool HandleLookupSpellCommand(const char* args);336 bool HandleLookupTeleCommand(const char * args);337 338 341 bool HandleCooldownCommand(const char* args); 339 342 bool HandleUnLearnCommand(const char* args); … … 354 357 bool HandleSpawnTransportCommand(const char* args); 355 358 bool HandleExploreCheatCommand(const char* args); 356 bool HandleTextEmoteCommand(const char* args);357 bool HandleNpcInfoCommand(const char* args);358 359 bool HandleHoverCommand(const char* args); 359 360 bool HandleWaterwalkCommand(const char* args); … … 422 423 bool HandleLoadPDumpCommand(const char *args); 423 424 bool HandleWritePDumpCommand(const char *args); 424 bool HandleChangeEntryCommand(const char *args);425 425 bool HandleCastCommand(const char *args); 426 426 bool HandleCastBackCommand(const char *args); -
trunk/src/game/Guild.h
r173 r177 328 328 } 329 329 int32 GetRank(uint32 LowGuid); 330 bool IsMember(uint32 LowGuid) 331 { 332 return (members.find(LowGuid) != members.end()); 333 } 330 334 331 335 void Roster(WorldSession *session); -
trunk/src/game/GuildHandler.cpp
r173 r177 153 153 154 154 std::string plName; 155 uint64 plGuid;156 uint32 plGuildId;157 Guild *guild;158 Player *player;159 155 160 156 //sLog.outDebug("WORLD: Received CMSG_GUILD_REMOVE"); … … 165 161 return; 166 162 167 guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());163 Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); 168 164 if(!guild) 169 165 { … … 178 174 } 179 175 180 player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); 181 if(player) 182 { 183 plGuid = player->GetGUID(); 184 plGuildId = player->GetGuildId(); 185 } 186 else 187 { 188 plGuid = objmgr.GetPlayerGUIDByName(plName); 189 plGuildId = Player::GetGuildIdFromDB(plGuid); 190 } 176 uint64 plGuid = objmgr.GetPlayerGUIDByName(plName); 191 177 192 178 if(!plGuid) … … 202 188 } 203 189 204 if( GetPlayer()->GetGuildId() != plGuildId)190 if(!guild->IsMember(GUID_LOPART(plGuid))) 205 191 { 206 192 SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); … … 488 474 489 475 std::string name; 490 Player *newLeader;491 uint64 newLeaderGUID;492 uint32 newLeaderGuild;493 476 Player *oldLeader = GetPlayer(); 494 477 Guild *guild; … … 503 486 guild = objmgr.GetGuildById(oldLeader->GetGuildId()); 504 487 505 if (!guild)488 if (!guild) 506 489 { 507 490 SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); … … 509 492 } 510 493 511 if( oldLeader->GetGUID() != guild->GetLeader())494 if( oldLeader->GetGUID() != guild->GetLeader()) 512 495 { 513 496 SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); … … 515 498 } 516 499 517 newLeader = ObjectAccessor::Instance().FindPlayerByName(name.c_str()); 518 if(newLeader) 519 { 520 newLeaderGUID = newLeader->GetGUID(); 521 newLeaderGuild = newLeader->GetGuildId(); 522 } 523 else 524 { 525 newLeaderGUID = objmgr.GetPlayerGUIDByName(name); 526 newLeaderGuild = Player::GetGuildIdFromDB(newLeaderGUID); 527 } 528 if(!newLeaderGUID) 500 uint64 newLeaderGUID = objmgr.GetPlayerGUIDByName(name); 501 if (!newLeaderGUID) 529 502 { 530 503 SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND); 531 504 return; 532 505 } 533 if( oldLeader->GetGuildId() != newLeaderGuild)506 if(!guild->IsMember(GUID_LOPART(newLeaderGUID))) 534 507 { 535 508 SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); … … 589 562 CHECK_PACKET_SIZE(recvPacket, 1); 590 563 591 Guild *guild;592 Player *player;593 uint64 plGuid;594 uint32 plGuildId;595 564 std::string name,PNOTE; 596 565 … … 602 571 return; 603 572 604 guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());605 if (!guild)573 Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); 574 if (!guild) 606 575 { 607 576 SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); … … 609 578 } 610 579 611 if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EPNOTE))580 if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EPNOTE)) 612 581 { 613 582 SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); … … 615 584 } 616 585 617 player = ObjectAccessor::Instance().FindPlayerByName(name.c_str()); 618 if(player) 619 { 620 plGuid = player->GetGUID(); 621 plGuildId = player->GetGuildId(); 622 } 623 else 624 { 625 plGuid = objmgr.GetPlayerGUIDByName(name); 626 plGuildId = Player::GetGuildIdFromDB(plGuid); 627 } 628 629 if(!plGuid) 586 uint64 plGuid = objmgr.GetPlayerGUIDByName(name); 587 588 if (!plGuid) 630 589 { 631 590 SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND); 632 591 return; 633 592 } 634 else if(GetPlayer()->GetGuildId() != plGuildId) 593 594 if (!guild->IsMember(GUID_LOPART(plGuid))) 635 595 { 636 596 SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); … … 648 608 CHECK_PACKET_SIZE(recvPacket, 1); 649 609 650 Guild *guild;651 Player *player;652 uint64 plGuid;653 uint32 plGuildId;654 610 std::string plName, OFFNOTE; 655 611 … … 661 617 return; 662 618 663 guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());664 if (!guild)619 Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); 620 if (!guild) 665 621 { 666 622 SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); 667 623 return; 668 624 } 669 if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EOFFNOTE))625 if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EOFFNOTE)) 670 626 { 671 627 SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); … … 673 629 } 674 630 675 player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); 676 if(player) 677 { 678 plGuid = player->GetGUID(); 679 plGuildId = player->GetGuildId(); 680 } 681 else 682 { 683 plGuid = objmgr.GetPlayerGUIDByName(plName); 684 plGuildId = Player::GetGuildIdFromDB(plGuid); 685 } 686 687 if( !plGuid ) 631 uint64 plGuid = objmgr.GetPlayerGUIDByName(plName); 632 633 if (!plGuid) 688 634 { 689 635 SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); 690 636 return; 691 637 } 692 else if(GetPlayer()->GetGuildId() != plGuildId) 638 639 if (!guild->IsMember(GUID_LOPART(plGuid))) 693 640 { 694 641 SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); -
trunk/src/game/Language.h
r163 r177 698 698 699 699 // Level 3 (continue) 700 LANG_ MOTD_NEW= 1100,701 LANG_ ACCOUNT_SETADDON= 1101,700 LANG_ACCOUNT_SETADDON = 1100, 701 LANG_MOTD_NEW = 1101, 702 702 LANG_SENDMESSAGE = 1102, 703 703 LANG_EVENT_ENTRY_LIST_CONSOLE = 1103, -
trunk/src/game/Level1.cpp
r132 r177 39 39 #endif 40 40 41 bool ChatHandler::Handle SayCommand(const char* args)41 bool ChatHandler::HandleNpcSayCommand(const char* args) 42 42 { 43 43 if(!*args) … … 57 57 } 58 58 59 bool ChatHandler::Handle YellCommand(const char* args)59 bool ChatHandler::HandleNpcYellCommand(const char* args) 60 60 { 61 61 if(!*args) … … 76 76 77 77 //show text emote by creature in chat 78 bool ChatHandler::Handle TextEmoteCommand(const char* args)78 bool ChatHandler::HandleNpcTextEmoteCommand(const char* args) 79 79 { 80 80 if(!*args) -
trunk/src/game/Level2.cpp
r173 r177 861 861 dstslot = (uint8)atoi(pParam2); 862 862 863 if(srcslot==dstslot) 864 return true; 865 863 866 uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot); 864 867 uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot); 865 868 866 if(srcslot==dstslot)867 return true;868 869 869 m_session->GetPlayer()->SwapItem( src, dst ); 870 870 … … 873 873 874 874 //add spawn of creature 875 bool ChatHandler::Handle AddSpwCommand(const char* args)875 bool ChatHandler::HandleNpcAddCommand(const char* args) 876 876 { 877 877 if(!*args) … … 923 923 } 924 924 925 bool ChatHandler::Handle DelCreatureCommand(const char* args)925 bool ChatHandler::HandleNpcDeleteCommand(const char* args) 926 926 { 927 927 Creature* unit = NULL; … … 1071 1071 1072 1072 //move selected creature 1073 bool ChatHandler::Handle MoveCreatureCommand(const char* args)1073 bool ChatHandler::HandleNpcMoveCommand(const char* args) 1074 1074 { 1075 1075 uint32 lowguid = 0; … … 1324 1324 1325 1325 //add move for creature 1326 bool ChatHandler::Handle AddMoveCommand(const char* args)1326 bool ChatHandler::HandleNpcAddMoveCommand(const char* args) 1327 1327 { 1328 1328 if(!*args) … … 1398 1398 * change the movement type 1399 1399 */ 1400 bool ChatHandler::Handle SetMoveTypeCommand(const char* args)1400 bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args) 1401 1401 { 1402 1402 if(!*args) … … 1526 1526 1527 1527 return true; 1528 } // Handle SetMoveTypeCommand1528 } // HandleNpcSetMoveTypeCommand 1529 1529 1530 1530 //change level of creature or pet … … 1566 1566 1567 1567 //set npcflag of creature 1568 bool ChatHandler::HandleN PCFlagCommand(const char* args)1568 bool ChatHandler::HandleNpcFlagCommand(const char* args) 1569 1569 { 1570 1570 if (!*args) … … 1592 1592 1593 1593 //set model of creature 1594 bool ChatHandler::Handle SetModelCommand(const char* args)1594 bool ChatHandler::HandleNpcSetModelCommand(const char* args) 1595 1595 { 1596 1596 if (!*args) … … 1633 1633 } 1634 1634 1635 //set faction of creature or go1636 bool ChatHandler::Handle FactionIdCommand(const char* args)1635 //set faction of creature 1636 bool ChatHandler::HandleNpcFactionIdCommand(const char* args) 1637 1637 { 1638 1638 if (!*args) … … 2139 2139 2140 2140 //set spawn dist of creature 2141 bool ChatHandler::Handle SpawnDistCommand(const char* args)2141 bool ChatHandler::HandleNpcSpawnDistCommand(const char* args) 2142 2142 { 2143 2143 if(!*args) … … 2177 2177 } 2178 2178 2179 bool ChatHandler::Handle SpawnTimeCommand(const char* args)2179 bool ChatHandler::HandleNpcSpawnTimeCommand(const char* args) 2180 2180 { 2181 2181 if(!*args) -
trunk/src/game/Level3.cpp
r174 r177 3657 3657 3658 3658 //play npc emote 3659 bool ChatHandler::Handle PlayEmoteCommand(const char* args)3659 bool ChatHandler::HandleNpcPlayEmoteCommand(const char* args) 3660 3660 { 3661 3661 uint32 emote = atoi((char*)args); … … 5565 5565 } 5566 5566 5567 bool ChatHandler::Handle ChangeEntryCommand(const char *args)5567 bool ChatHandler::HandleNpcChangeEntryCommand(const char *args) 5568 5568 { 5569 5569 if(!args) -
trunk/src/game/Player.cpp
r174 r177 3926 3926 for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) 3927 3927 if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) 3928 if(ItemPrototype const *pBagProto = pBag->GetProto()) 3929 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 3930 if(Item* pItem = GetItemByPos( i, j )) 3931 DurabilityLoss(pItem,percent); 3928 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 3929 if(Item* pItem = GetItemByPos( i, j )) 3930 DurabilityLoss(pItem,percent); 3932 3931 } 3933 3932 } … … 3971 3970 for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) 3972 3971 if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) 3973 if(ItemPrototype const *pBagProto = pBag->GetProto()) 3974 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 3975 if(Item* pItem = GetItemByPos( i, j )) 3976 DurabilityPointsLoss(pItem,points); 3972 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 3973 if(Item* pItem = GetItemByPos( i, j )) 3974 DurabilityPointsLoss(pItem,points); 3977 3975 } 3978 3976 } … … 8327 8325 } 8328 8326 Bag *pBag; 8329 ItemPrototype const *pBagProto;8330 8327 for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) 8331 8328 { … … 8333 8330 if( pBag ) 8334 8331 { 8335 pBagProto = pBag->GetProto();8336 if( pBagProto )8337 {8338 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++)8332 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 8333 { 8334 pItem = GetItemByPos( i, j ); 8335 if( pItem && pItem->GetEntry() == item ) 8339 8336 { 8340 pItem = GetItemByPos( i, j ); 8341 if( pItem && pItem->GetEntry() == item ) 8342 { 8343 tempcount += pItem->GetCount(); 8344 if( tempcount >= count ) 8345 return EQUIP_ERR_OK; 8346 } 8337 tempcount += pItem->GetCount(); 8338 if( tempcount >= count ) 8339 return EQUIP_ERR_OK; 8347 8340 } 8348 8341 } … … 8435 8428 if( pBag ) 8436 8429 { 8437 ItemPrototype const *pBagProto = pBag->GetProto(); 8438 if( pBagProto ) 8439 { 8440 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 8441 { 8442 Item* pItem = pBag->GetItemByPos( j ); 8443 if( pItem && pItem->GetGUID() == guid ) 8444 return pItem; 8445 } 8430 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 8431 { 8432 Item* pItem = pBag->GetItemByPos( j ); 8433 if( pItem && pItem->GetGUID() == guid ) 8434 return pItem; 8446 8435 } 8447 8436 } … … 8452 8441 if( pBag ) 8453 8442 { 8454 ItemPrototype const *pBagProto = pBag->GetProto(); 8455 if( pBagProto ) 8456 { 8457 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 8458 { 8459 Item* pItem = pBag->GetItemByPos( j ); 8460 if( pItem && pItem->GetGUID() == guid ) 8461 return pItem; 8462 } 8443 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 8444 { 8445 Item* pItem = pBag->GetItemByPos( j ); 8446 if( pItem && pItem->GetGUID() == guid ) 8447 return pItem; 8463 8448 } 8464 8449 } … … 8618 8603 if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) 8619 8604 { 8620 if(ItemPrototype const *pBagProto = pBag->GetProto()) 8621 { 8622 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 8605 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 8606 { 8607 Item* pItem = GetItemByPos( i, j ); 8608 if( pItem && pItem->GetEntry() == item ) 8609 { 8610 tempcount += pItem->GetCount(); 8611 if( tempcount >= count ) 8612 return true; 8613 } 8614 } 8615 } 8616 } 8617 8618 if(inBankAlso) 8619 { 8620 for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) 8621 { 8622 Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); 8623 if( pItem && pItem->GetEntry() == item ) 8624 { 8625 tempcount += pItem->GetCount(); 8626 if( tempcount >= count ) 8627 return true; 8628 } 8629 } 8630 for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) 8631 { 8632 if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) 8633 { 8634 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 8623 8635 { 8624 8636 Item* pItem = GetItemByPos( i, j ); … … 8634 8646 } 8635 8647 8636 if(inBankAlso)8637 {8638 for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++)8639 {8640 Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );8641 if( pItem && pItem->GetEntry() == item )8642 {8643 tempcount += pItem->GetCount();8644 if( tempcount >= count )8645 return true;8646 }8647 }8648 for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)8649 {8650 if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))8651 {8652 if(ItemPrototype const *pBagProto = pBag->GetProto())8653 {8654 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++)8655 {8656 Item* pItem = GetItemByPos( i, j );8657 if( pItem && pItem->GetEntry() == item )8658 {8659 tempcount += pItem->GetCount();8660 if( tempcount >= count )8661 return true;8662 }8663 }8664 }8665 }8666 }8667 }8668 8669 8648 return false; 8670 8649 } … … 8738 8717 return true; 8739 8718 } 8740 Bag *pBag;8741 ItemPrototype const *pBagProto;8742 8719 for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) 8743 8720 { 8744 pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); 8745 if( pBag ) 8746 { 8747 pBagProto = pBag->GetProto(); 8748 if( pBagProto ) 8749 { 8750 for(uint32 j = 0; j < pBagProto->ContainerSlots; ++j) 8751 { 8752 pItem = GetItemByPos( i, j ); 8753 if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory )) 8754 return true; 8755 } 8721 if(Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) 8722 { 8723 for(uint32 j = 0; j < pBag->GetBagSize(); ++j) 8724 { 8725 pItem = GetItemByPos( i, j ); 8726 if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory )) 8727 return true; 8756 8728 } 8757 8729 } … … 8847 8819 return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; 8848 8820 8849 for(uint32 j = 0; j < pBag Proto->ContainerSlots; j++)8821 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 8850 8822 { 8851 8823 // skip specific slot already processed in first called _CanStoreItem_InSpecificSlot … … 9354 9326 for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) 9355 9327 { 9356 Bag *pBag; 9357 ItemPrototype const *pBagProto; 9358 9359 pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); 9360 if( pBag ) 9361 { 9362 pBagProto = pBag->GetProto(); 9363 9364 if( pBagProto ) 9365 { 9366 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 9328 if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) 9329 { 9330 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 9331 { 9332 pItem2 = GetItemByPos( i, j ); 9333 if (pItem2 && !pItem2->IsInTrade()) 9367 9334 { 9368 pItem2 = GetItemByPos( i, j ); 9369 if (pItem2 && !pItem2->IsInTrade()) 9370 { 9371 inv_bags[i-INVENTORY_SLOT_BAG_START][j] = pItem2->GetCount(); 9372 } 9335 inv_bags[i-INVENTORY_SLOT_BAG_START][j] = pItem2->GetCount(); 9373 9336 } 9374 9337 } … … 9437 9400 if( pBag ) 9438 9401 { 9439 pBagProto = pBag->GetProto(); 9440 if( pBagProto ) 9402 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 9441 9403 { 9442 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 9404 pItem2 = GetItemByPos( t, j ); 9405 if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->Stackable ) 9443 9406 { 9444 pItem2 = GetItemByPos( t, j ); 9445 if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->Stackable ) 9446 { 9447 inv_bags[t-INVENTORY_SLOT_BAG_START][j] += pItem->GetCount(); 9448 b_found = true; 9449 break; 9450 } 9407 inv_bags[t-INVENTORY_SLOT_BAG_START][j] += pItem->GetCount(); 9408 b_found = true; 9409 break; 9451 9410 } 9452 9411 } … … 9487 9446 ItemCanGoIntoBag(pProto,pBagProto) ) 9488 9447 { 9489 for(uint32 j = 0; j < pBag Proto->ContainerSlots; j++)9448 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 9490 9449 { 9491 9450 if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 ) … … 9521 9480 if( pBag ) 9522 9481 { 9523 pBagProto = pBag->GetProto(); 9524 if( pBagProto && ItemCanGoIntoBag(pProto,pBagProto)) 9482 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 9525 9483 { 9526 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++)9484 if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 ) 9527 9485 { 9528 if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 ) 9529 { 9530 inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1; 9531 b_found = true; 9532 break; 9533 } 9486 inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1; 9487 b_found = true; 9488 break; 9534 9489 } 9535 9490 } … … 10625 10580 10626 10581 // in inventory bags 10627 Bag *pBag;10628 ItemPrototype const *pBagProto;10629 10582 for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) 10630 10583 { 10631 pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); 10632 if( pBag ) 10633 { 10634 pBagProto = pBag->GetProto(); 10635 if( pBagProto ) 10636 { 10637 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 10584 if(Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) 10585 { 10586 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 10587 { 10588 pItem = pBag->GetItemByPos(j); 10589 if( pItem && pItem->GetEntry() == item ) 10638 10590 { 10639 pItem = pBag->GetItemByPos(j);10640 if( pItem && pItem->GetEntry() == item)10591 // all items in bags can be unequipped 10592 if( pItem->GetCount() + remcount <= count ) 10641 10593 { 10642 // all items in bags can be unequipped 10643 if( pItem->GetCount() + remcount <= count ) 10644 { 10645 remcount += pItem->GetCount(); 10646 DestroyItem( i, j, update ); 10647 10648 if(remcount >=count) 10649 return; 10650 } 10651 else 10652 { 10653 pProto = pItem->GetProto(); 10654 ItemRemovedQuestCheck( pItem->GetEntry(), count - remcount ); 10655 pItem->SetCount( pItem->GetCount() - count + remcount ); 10656 if( IsInWorld() && update ) 10657 pItem->SendUpdateToPlayer( this ); 10658 pItem->SetState(ITEM_CHANGED, this); 10594 remcount += pItem->GetCount(); 10595 DestroyItem( i, j, update ); 10596 10597 if(remcount >=count) 10659 10598 return; 10660 } 10599 } 10600 else 10601 { 10602 pProto = pItem->GetProto(); 10603 ItemRemovedQuestCheck( pItem->GetEntry(), count - remcount ); 10604 pItem->SetCount( pItem->GetCount() - count + remcount ); 10605 if( IsInWorld() && update ) 10606 pItem->SendUpdateToPlayer( this ); 10607 pItem->SetState(ITEM_CHANGED, this); 10608 return; 10661 10609 } 10662 10610 } … … 10720 10668 if( pBag ) 10721 10669 { 10722 ItemPrototype const *pBagProto = pBag->GetProto(); 10723 if( pBagProto ) 10724 { 10725 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 10726 { 10727 Item* pItem = pBag->GetItemByPos(j); 10728 if( pItem && pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone) ) 10729 DestroyItem( i, j, update); 10730 } 10670 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 10671 { 10672 Item* pItem = pBag->GetItemByPos(j); 10673 if( pItem && pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone) ) 10674 DestroyItem( i, j, update); 10731 10675 } 10732 10676 } … … 10764 10708 if( pBag ) 10765 10709 { 10766 ItemPrototype const *pBagProto = pBag->GetProto(); 10767 if( pBagProto ) 10768 { 10769 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 10770 { 10771 Item* pItem = pBag->GetItemByPos(j); 10772 if( pItem && pItem->GetProto() && 10773 (pItem->GetProto()->Class == ITEM_CLASS_CONSUMABLE) && 10774 (pItem->GetProto()->Flags & ITEM_FLAGS_CONJURED) ) 10775 DestroyItem( i, j, update); 10776 } 10710 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 10711 { 10712 Item* pItem = pBag->GetItemByPos(j); 10713 if( pItem && pItem->GetProto() && 10714 (pItem->GetProto()->Class == ITEM_CLASS_CONSUMABLE) && 10715 (pItem->GetProto()->Flags & ITEM_FLAGS_CONJURED) ) 10716 DestroyItem( i, j, update); 10777 10717 } 10778 10718 } … … 11423 11363 if( pBag ) 11424 11364 { 11425 ItemPrototype const *pBagProto = pBag->GetProto(); 11426 if( pBagProto ) 11427 { 11428 for(uint32 j = 0; j < pBagProto->ContainerSlots; j++) 11429 { 11430 Item* pItem = pBag->GetItemByPos(j); 11431 if( pItem && pItem->GetEnchantmentId(slot) ) 11432 pItem->ClearEnchantment(slot); 11433 } 11365 for(uint32 j = 0; j < pBag->GetBagSize(); j++) 11366 { 11367 Item* pItem = pBag->GetItemByPos(j); 11368 if( pItem && pItem->GetEnchantmentId(slot) ) 11369 pItem->ClearEnchantment(slot); 11434 11370 } 11435 11371 } … … 15717 15653 } 15718 15654 15655 void Player::PlaySound(uint32 Sound, bool OnlySelf) 15656 { 15657 WorldPacket data(SMSG_PLAY_SOUND, 4); 15658 data << Sound; 15659 if (OnlySelf) 15660 GetSession()->SendPacket( &data ); 15661 else 15662 SendMessageToSet( &data, true ); 15663 } 15664 15719 15665 void Player::SendExplorationExperience(uint32 Area, uint32 Experience) 15720 15666 { -
trunk/src/game/Player.h
r174 r177 1606 1606 void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP); 1607 1607 1608 //Low Level Packets 1609 void PlaySound(uint32 Sound, bool OnlySelf); 1608 1610 //notifiers 1609 1611 void SendAttackSwingCantAttack(); -
trunk/src/game/debugcmds.cpp
r102 r177 320 320 { 321 321 Bag *bag = (Bag*)item; 322 const ItemPrototype *proto = bag->GetProto(); 323 for (uint8 j = 0; j < proto->ContainerSlots; ++j) 322 for (uint8 j = 0; j < bag->GetBagSize(); ++j) 324 323 { 325 324 Item* item = bag->GetItemByPos(j); … … 417 416 { 418 417 Bag *bag = (Bag*)item; 419 const ItemPrototype *proto = bag->GetProto(); 420 for (uint8 j = 0; j < proto->ContainerSlots; ++j) 418 for (uint8 j = 0; j < bag->GetBagSize(); ++j) 421 419 { 422 420 Item* item = bag->GetItemByPos(j);