Changeset 177 for trunk/src/game/GuildHandler.cpp
- Timestamp:
- 11/19/08 13:43:30 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
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);