mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10256] New auction command with subcommands for look different auction stores from anywhere.
This commit is contained in:
parent
dbf2d02762
commit
9a6535963c
13 changed files with 151 additions and 40 deletions
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
|||
`version` varchar(120) default NULL,
|
||||
`creature_ai_version` varchar(120) default NULL,
|
||||
`cache_id` int(10) default '0',
|
||||
`required_10252_01_mangos_reputation_reward_rate` bit(1) default NULL
|
||||
`required_10256_01_mangos_command` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
@ -520,6 +520,10 @@ INSERT INTO `command` VALUES
|
|||
('additem',3,'Syntax: .additem #itemid/[#itemname]/#shift-click-item-link #itemcount\r\n\r\nAdds the specified number of items of id #itemid (or exact (!) name $itemname in brackets, or link created by shift-click at item in inventory or recipe) to your or selected character inventory. If #itemcount is omitted, only one item will be added.\r\n.'),
|
||||
('additemset',3,'Syntax: .additemset #itemsetid\r\n\r\nAdd items from itemset of id #itemsetid to your or selected character inventory. Will add by one example each item from itemset.'),
|
||||
('announce',1,'Syntax: .announce $MessageToBroadcast\r\n\r\nSend a global message to all players online in chat log.'),
|
||||
('auction',3,'Syntax: .auction\r\n\r\nShow your team auction store.'),
|
||||
('auction aliance',3,'Syntax: .auction aliance\r\n\r\nShow aliance auction store independent from your team.'),
|
||||
('auction goblin',3,'Syntax: .auction goblin\r\n\r\nShow goblin auction store common for all teams.'),
|
||||
('auction horde',3,'Syntax: .auction horde\r\n\r\nShow horde auction store independent from your team.'),
|
||||
('aura',3,'Syntax: .aura #spellid\r\n\r\nAdd the aura from spell #spellid to the selected Unit.'),
|
||||
('ban account',3,'Syntax: .ban account $Name $bantime $reason\r\nBan account kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),
|
||||
('ban character',3,'Syntax: .ban character $Name $bantime $reason\r\nBan account and kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),
|
||||
|
|
|
|||
8
sql/updates/10256_01_mangos_command.sql
Normal file
8
sql/updates/10256_01_mangos_command.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_10252_01_mangos_reputation_reward_rate required_10256_01_mangos_command bit;
|
||||
|
||||
DELETE FROM command WHERE name IN ('auction','auction aliance','auction goblin','auction horde');
|
||||
INSERT INTO command (name, security, help) VALUES
|
||||
('auction',3,'Syntax: .auction\r\n\r\nShow your team auction store.'),
|
||||
('auction aliance',3,'Syntax: .auction aliance\r\n\r\nShow aliance auction store independent from your team.'),
|
||||
('auction goblin',3,'Syntax: .auction goblin\r\n\r\nShow goblin auction store common for all teams.'),
|
||||
('auction horde',3,'Syntax: .auction horde\r\n\r\nShow horde auction store independent from your team.');
|
||||
|
|
@ -123,6 +123,7 @@ pkgdata_DATA = \
|
|||
10251_01_mangos_command.sql \
|
||||
10252_01_mangos_reputation_reward_rate.sql \
|
||||
10254_01_characters_auctionhouse.sql \
|
||||
10256_01_mangos_command.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -226,4 +227,5 @@ EXTRA_DIST = \
|
|||
10251_01_mangos_command.sql \
|
||||
10252_01_mangos_reputation_reward_rate.sql \
|
||||
10254_01_characters_auctionhouse.sql \
|
||||
10256_01_mangos_command.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "AuctionHouseMgr.h"
|
||||
#include "Mail.h"
|
||||
#include "Util.h"
|
||||
#include "Chat.h"
|
||||
|
||||
// please DO NOT use iterator++, because it is slower than ++iterator!!!
|
||||
// post-incrementation is always slower than pre-incrementation !
|
||||
|
|
@ -53,10 +54,10 @@ void WorldSession::HandleAuctionHelloOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// this void causes that auction window is opened
|
||||
void WorldSession::SendAuctionHello(Creature* unit)
|
||||
void WorldSession::SendAuctionHello(Unit* unit)
|
||||
{
|
||||
// always return pointer
|
||||
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->getFaction());
|
||||
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit);
|
||||
|
||||
WorldPacket data( MSG_AUCTION_HELLO, 12 );
|
||||
data << unit->GetObjectGuid();
|
||||
|
|
@ -154,15 +155,34 @@ void WorldSession::SendAuctionCancelledToBidderMail( AuctionEntry* auction )
|
|||
|
||||
AuctionHouseEntry const* WorldSession::GetCheckedAuctionHouseForAuctioneer(ObjectGuid guid)
|
||||
{
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!pCreature)
|
||||
Unit* auctioneer = NULL;
|
||||
|
||||
// GM case
|
||||
if (guid == GetPlayer()->GetObjectGuid())
|
||||
{
|
||||
// command case will return only if player have real access to command
|
||||
// using special access modes (1,-1) done at mode set in command, so not need recheck
|
||||
if (GetPlayer()->GetAuctionAccessMode()==0 && !ChatHandler(GetPlayer()).FindCommand("auction"))
|
||||
{
|
||||
DEBUG_LOG("%s attempt open auction in cheating way.", guid.GetString().c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
auctioneer = GetPlayer();
|
||||
}
|
||||
// auctioneer case
|
||||
else
|
||||
{
|
||||
auctioneer = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!auctioneer)
|
||||
{
|
||||
DEBUG_LOG("Auctioneeer %s accessed in cheating way.", guid.GetString().c_str());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// always return pointer
|
||||
return AuctionHouseMgr::GetAuctionHouseEntry(pCreature->getFaction());
|
||||
return AuctionHouseMgr::GetAuctionHouseEntry(auctioneer);
|
||||
}
|
||||
|
||||
// this void creates new auction and adds auction to some auctionhouse
|
||||
|
|
|
|||
|
|
@ -478,15 +478,18 @@ uint32 AuctionHouseMgr::GetAuctionHouseTeam(AuctionHouseEntry const* house)
|
|||
}
|
||||
}
|
||||
|
||||
AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTemplateId)
|
||||
AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit)
|
||||
{
|
||||
uint32 houseid = 1; // dwarf auction house (used for normal cut/etc percents)
|
||||
|
||||
if(!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
{
|
||||
if (unit->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
//FIXME: found way for proper auctionhouse selection by another way
|
||||
// AuctionHo use.dbc have faction field with _player_ factions associated with auction house races.
|
||||
// but no easy way convert creature faction to player race faction for specific city
|
||||
uint32 factionTemplateId = unit->getFaction();
|
||||
switch(factionTemplateId)
|
||||
{
|
||||
case 12: houseid = 1; break; // human
|
||||
|
|
@ -516,6 +519,21 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Player* player = (Player*)unit;
|
||||
if (player->GetAuctionAccessMode() > 0)
|
||||
houseid = 7;
|
||||
else
|
||||
{
|
||||
switch (((Player*)unit)->GetTeam())
|
||||
{
|
||||
case ALLIANCE: houseid = player->GetAuctionAccessMode() == 0 ? 1 : 6; break;
|
||||
case HORDE: houseid = player->GetAuctionAccessMode() == 0 ? 6 : 1; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sAuctionHouseStore.LookupEntry(houseid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ class AuctionHouseMgr
|
|||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
|
||||
|
||||
static uint32 GetAuctionHouseTeam(AuctionHouseEntry const* house);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(Unit* unit);
|
||||
|
||||
public:
|
||||
//load first auction items, because of check if item exists, when loading
|
||||
|
|
|
|||
|
|
@ -85,6 +85,15 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand auctionCommandTable[] =
|
||||
{
|
||||
{ "aliance", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuctionAlianceCommand, "", NULL },
|
||||
{ "goblin", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuctionGoblinCommand, "", NULL },
|
||||
{ "horde", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuctionHordeCommand, "", NULL },
|
||||
{ "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuctionCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand banCommandTable[] =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanAccountCommand, "", NULL },
|
||||
|
|
@ -621,6 +630,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "account", SEC_PLAYER, true, NULL, "", accountCommandTable },
|
||||
{ "auction", SEC_ADMINISTRATOR, false, NULL, "", auctionCommandTable },
|
||||
{ "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
|
||||
{ "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable},
|
||||
{ "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable },
|
||||
|
|
|
|||
|
|
@ -119,6 +119,11 @@ class ChatHandler
|
|||
bool HandleAccountSetGmLevelCommand(const char* args);
|
||||
bool HandleAccountSetPasswordCommand(const char* args);
|
||||
|
||||
bool HandleAuctionAlianceCommand(const char* args);
|
||||
bool HandleAuctionGoblinCommand(const char* args);
|
||||
bool HandleAuctionHordeCommand(const char* args);
|
||||
bool HandleAuctionCommand(const char* args);
|
||||
|
||||
bool HandleBanAccountCommand(const char* args);
|
||||
bool HandleBanCharacterCommand(const char* args);
|
||||
bool HandleBanIPCommand(const char* args);
|
||||
|
|
|
|||
|
|
@ -4145,6 +4145,35 @@ bool ChatHandler::HandleHideAreaCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleAuctionAlianceCommand(const char* /*args*/)
|
||||
{
|
||||
m_session->GetPlayer()->SetAuctionAccessMode(m_session->GetPlayer()->GetTeam() != ALLIANCE ? -1 : 0);
|
||||
m_session->SendAuctionHello(m_session->GetPlayer());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleAuctionHordeCommand(const char* /*args*/)
|
||||
{
|
||||
m_session->GetPlayer()->SetAuctionAccessMode(m_session->GetPlayer()->GetTeam() != HORDE ? -1 : 0);
|
||||
m_session->SendAuctionHello(m_session->GetPlayer());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleAuctionGoblinCommand(const char* /*args*/)
|
||||
{
|
||||
m_session->GetPlayer()->SetAuctionAccessMode(1);
|
||||
m_session->SendAuctionHello(m_session->GetPlayer());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleAuctionCommand(const char* /*args*/)
|
||||
{
|
||||
m_session->GetPlayer()->SetAuctionAccessMode(0);
|
||||
m_session->SendAuctionHello(m_session->GetPlayer());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleBankCommand(const char* /*args*/)
|
||||
{
|
||||
m_session->SendShowBank( m_session->GetPlayer()->GetGUID() );
|
||||
|
|
|
|||
|
|
@ -620,6 +620,8 @@ enum PlayerExtraFlags
|
|||
PLAYER_EXTRA_TAXICHEAT = 0x0008,
|
||||
PLAYER_EXTRA_GM_INVISIBLE = 0x0010,
|
||||
PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages
|
||||
PLAYER_EXTRA_AUCTION_NEUTRAL = 0x0040,
|
||||
PLAYER_EXTRA_AUCTION_ENEMY = 0x0080, // overwrite PLAYER_EXTRA_AUCTION_NEUTRAL
|
||||
|
||||
// other states
|
||||
PLAYER_EXTRA_PVP_DEATH = 0x0100 // store PvP death status until corpse creating.
|
||||
|
|
@ -1161,6 +1163,19 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
void SetGMVisible(bool on);
|
||||
void SetPvPDeath(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
|
||||
|
||||
// 0 = own auction, -1 = enemy auction, 1 = goblin auction
|
||||
int GetAuctionAccessMode() const { return m_ExtraFlags & PLAYER_EXTRA_AUCTION_ENEMY ? -1 : (m_ExtraFlags & PLAYER_EXTRA_AUCTION_NEUTRAL ? 1 : 0); }
|
||||
void SetAuctionAccessMode(int state)
|
||||
{
|
||||
m_ExtraFlags &= ~ (PLAYER_EXTRA_AUCTION_ENEMY|PLAYER_EXTRA_AUCTION_NEUTRAL);
|
||||
|
||||
if(state < 0)
|
||||
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_ENEMY;
|
||||
else if( state > 0)
|
||||
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_NEUTRAL;
|
||||
}
|
||||
|
||||
|
||||
void GiveXP(uint32 xp, Unit* victim);
|
||||
void GiveLevel(uint32 level);
|
||||
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ class MANGOS_DLL_SPEC WorldSession
|
|||
bool SendItemInfo( uint32 itemid, WorldPacket data );
|
||||
|
||||
//auction
|
||||
void SendAuctionHello(Creature * unit);
|
||||
void SendAuctionHello(Unit * unit);
|
||||
void SendAuctionCommandResult( uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
|
||||
void SendAuctionBidderNotification( uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template);
|
||||
void SendAuctionOwnerNotification( AuctionEntry * auction );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10255"
|
||||
#define REVISION_NR "10256"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_10254_01_characters_auctionhouse"
|
||||
#define REVISION_DB_MANGOS "required_10252_01_mangos_reputation_reward_rate"
|
||||
#define REVISION_DB_MANGOS "required_10256_01_mangos_command"
|
||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue