Merge pull request #13809 from AriDEV/6.x
Server/PacketIO: Currency Updates
This commit is contained in:
@@ -636,11 +636,13 @@ DROP TABLE IF EXISTS `character_currency`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `character_currency` (
|
||||
`guid` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`currency` smallint(5) unsigned NOT NULL,
|
||||
`total_count` int(10) unsigned NOT NULL,
|
||||
`week_count` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`guid`,`currency`)
|
||||
`CharacterGuid` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`Currency` smallint(5) unsigned NOT NULL,
|
||||
`Quantity` int(10) unsigned NOT NULL,
|
||||
`WeeklyQuantity` int(10) unsigned NOT NULL,
|
||||
`TrackedQuantity` int(10) unsigned NOT NULL,
|
||||
`Flags` tinyint(3) unsigned NOT NULL,
|
||||
PRIMARY KEY (`CharacterGuid`,`Currency`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
DROP TABLE IF EXISTS `character_currency`;
|
||||
CREATE TABLE `character_currency` (
|
||||
`CharacterGuid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`Currency` SMALLINT(5) UNSIGNED NOT NULL,
|
||||
`Quantity` INT(10) UNSIGNED NOT NULL,
|
||||
`WeeklyQuantity` INT(10) UNSIGNED NOT NULL,
|
||||
`TrackedQuantity` INT(10) UNSIGNED NOT NULL,
|
||||
`Flags` TINYINT(3) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`CharacterGuid`, `Currency`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB;
|
||||
*/
|
||||
ALTER TABLE `character_currency`
|
||||
CHANGE COLUMN `guid` `CharacterGuid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' FIRST,
|
||||
CHANGE COLUMN `currency` `Currency` SMALLINT(5) UNSIGNED NOT NULL AFTER `CharacterGuid`,
|
||||
CHANGE COLUMN `total_count` `Quantity` INT(10) UNSIGNED NOT NULL AFTER `Currency`,
|
||||
CHANGE COLUMN `week_count` `WeeklyQuantity` INT(10) UNSIGNED NOT NULL AFTER `Quantity`,
|
||||
ADD COLUMN `TrackedQuantity` INT(10) UNSIGNED NOT NULL AFTER `WeeklyQuantity`,
|
||||
ADD COLUMN `Flags` TINYINT(3) UNSIGNED NOT NULL AFTER `TrackedQuantity`;
|
||||
@@ -6966,8 +6966,10 @@ void Player::_LoadCurrency(PreparedQueryResult result)
|
||||
|
||||
PlayerCurrency cur;
|
||||
cur.state = PLAYERCURRENCY_UNCHANGED;
|
||||
cur.weekCount = fields[1].GetUInt32();
|
||||
cur.totalCount = fields[2].GetUInt32();
|
||||
cur.Quantity = fields[1].GetUInt32();
|
||||
cur.WeeklyQuantity = fields[2].GetUInt32();
|
||||
cur.TrackedQuantity = fields[3].GetUInt32();
|
||||
cur.Flags = fields[4].GetUInt8();
|
||||
|
||||
_currencyStorage.insert(PlayerCurrenciesMap::value_type(currencyID, cur));
|
||||
|
||||
@@ -6989,16 +6991,20 @@ void Player::_SaveCurrency(SQLTransaction& trans)
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_PLAYER_CURRENCY);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
stmt->setUInt16(1, itr->first);
|
||||
stmt->setUInt32(2, itr->second.weekCount);
|
||||
stmt->setUInt32(3, itr->second.totalCount);
|
||||
stmt->setUInt32(2, itr->second.Quantity);
|
||||
stmt->setUInt32(3, itr->second.WeeklyQuantity);
|
||||
stmt->setUInt32(4, itr->second.TrackedQuantity);
|
||||
stmt->setUInt8(5, itr->second.Flags);
|
||||
trans->Append(stmt);
|
||||
break;
|
||||
case PLAYERCURRENCY_CHANGED:
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_CURRENCY);
|
||||
stmt->setUInt32(0, itr->second.weekCount);
|
||||
stmt->setUInt32(1, itr->second.totalCount);
|
||||
stmt->setUInt64(2, GetGUID().GetCounter());
|
||||
stmt->setUInt16(3, itr->first);
|
||||
stmt->setUInt32(0, itr->second.Quantity);
|
||||
stmt->setUInt32(1, itr->second.WeeklyQuantity);
|
||||
stmt->setUInt32(2, itr->second.TrackedQuantity);
|
||||
stmt->setUInt8(3, itr->second.Flags);
|
||||
stmt->setUInt64(4, GetGUID().GetCounter());
|
||||
stmt->setUInt16(5, itr->first);
|
||||
trans->Append(stmt);
|
||||
break;
|
||||
default:
|
||||
@@ -7015,47 +7021,29 @@ void Player::SendNewCurrency(uint32 id) const
|
||||
if (itr == _currencyStorage.end())
|
||||
return;
|
||||
|
||||
ByteBuffer currencyData;
|
||||
WorldPacket packet(SMSG_INIT_CURRENCY, 4 + (5*4 + 1));
|
||||
packet.WriteBits(1, 23);
|
||||
|
||||
CurrencyTypesEntry const* entry = sCurrencyTypesStore.LookupEntry(id);
|
||||
if (!entry) // should never happen
|
||||
return;
|
||||
|
||||
uint32 precision = (entry->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1;
|
||||
uint32 weekCount = itr->second.weekCount / precision;
|
||||
uint32 weekCap = GetCurrencyWeekCap(entry) / precision;
|
||||
WorldPackets::Misc::SetupCurrency packet;
|
||||
WorldPackets::Misc::SetupCurrency::Record record;
|
||||
record.Type = entry->ID;
|
||||
record.Quantity = itr->second.Quantity;
|
||||
record.WeeklyQuantity.Set(itr->second.WeeklyQuantity);
|
||||
record.MaxWeeklyQuantity.Set(GetCurrencyWeekCap(entry) / ((entry->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1));
|
||||
record.TrackedQuantity.Set(itr->second.TrackedQuantity);
|
||||
record.Flags = itr->second.Flags;
|
||||
|
||||
packet.WriteBit(weekCount);
|
||||
packet.WriteBits(0, 4); // some flags
|
||||
packet.WriteBit(weekCap);
|
||||
packet.WriteBit(0); // season total earned
|
||||
packet.Data.push_back(record);
|
||||
|
||||
currencyData << uint32(itr->second.totalCount / precision);
|
||||
if (weekCap)
|
||||
currencyData << uint32(weekCap);
|
||||
|
||||
//if (seasonTotal)
|
||||
// currencyData << uint32(seasonTotal / precision);
|
||||
|
||||
currencyData << uint32(entry->ID);
|
||||
if (weekCount)
|
||||
currencyData << uint32(weekCount);
|
||||
|
||||
packet.FlushBits();
|
||||
packet.append(currencyData);
|
||||
GetSession()->SendPacket(&packet);
|
||||
GetSession()->SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
void Player::SendCurrencies() const
|
||||
{
|
||||
ByteBuffer currencyData;
|
||||
WorldPacket packet(SMSG_INIT_CURRENCY, 4 + _currencyStorage.size()*(5*4 + 1));
|
||||
size_t count_pos = packet.bitwpos();
|
||||
packet.WriteBits(_currencyStorage.size(), 23);
|
||||
WorldPackets::Misc::SetupCurrency packet;
|
||||
packet.Data.reserve(_currencyStorage.size());
|
||||
|
||||
size_t count = 0;
|
||||
for (PlayerCurrenciesMap::const_iterator itr = _currencyStorage.begin(); itr != _currencyStorage.end(); ++itr)
|
||||
{
|
||||
CurrencyTypesEntry const* entry = sCurrencyTypesStore.LookupEntry(itr->first);
|
||||
@@ -7064,33 +7052,18 @@ void Player::SendCurrencies() const
|
||||
if (!entry || entry->CategoryID == CURRENCY_CATEGORY_META_CONQUEST)
|
||||
continue;
|
||||
|
||||
uint32 precision = (entry->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1;
|
||||
uint32 weekCount = itr->second.weekCount / precision;
|
||||
uint32 weekCap = GetCurrencyWeekCap(entry) / precision;
|
||||
WorldPackets::Misc::SetupCurrency::Record record;
|
||||
record.Type = entry->ID;
|
||||
record.Quantity = itr->second.Quantity;
|
||||
record.WeeklyQuantity.Set(itr->second.WeeklyQuantity);
|
||||
record.MaxWeeklyQuantity.Set(GetCurrencyWeekCap(entry) / ((entry->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1));
|
||||
record.TrackedQuantity.Set(itr->second.TrackedQuantity);
|
||||
record.Flags = itr->second.Flags;
|
||||
|
||||
packet.WriteBit(weekCount);
|
||||
packet.WriteBits(0, 4); // some flags
|
||||
packet.WriteBit(weekCap);
|
||||
packet.WriteBit(0); // season total earned
|
||||
|
||||
currencyData << uint32(itr->second.totalCount / precision);
|
||||
if (weekCap)
|
||||
currencyData << uint32(weekCap);
|
||||
|
||||
//if (seasonTotal)
|
||||
// currencyData << uint32(seasonTotal / precision);
|
||||
|
||||
currencyData << uint32(entry->ID);
|
||||
if (weekCount)
|
||||
currencyData << uint32(weekCount);
|
||||
|
||||
++count;
|
||||
packet.Data.push_back(record);
|
||||
}
|
||||
|
||||
packet.FlushBits();
|
||||
packet.append(currencyData);
|
||||
packet.PutBits(count_pos, count, 23);
|
||||
GetSession()->SendPacket(&packet);
|
||||
GetSession()->SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
void Player::SendPvpRewards() const
|
||||
@@ -7115,7 +7088,7 @@ uint32 Player::GetCurrency(uint32 id, bool usePrecision) const
|
||||
CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(id);
|
||||
uint32 precision = (usePrecision && currency->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1;
|
||||
|
||||
return itr->second.totalCount / precision;
|
||||
return itr->second.Quantity / precision;
|
||||
}
|
||||
|
||||
uint32 Player::GetCurrencyOnWeek(uint32 id, bool usePrecision) const
|
||||
@@ -7127,13 +7100,13 @@ uint32 Player::GetCurrencyOnWeek(uint32 id, bool usePrecision) const
|
||||
CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(id);
|
||||
uint32 precision = (usePrecision && currency->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1;
|
||||
|
||||
return itr->second.weekCount / precision;
|
||||
return itr->second.WeeklyQuantity / precision;
|
||||
}
|
||||
|
||||
bool Player::HasCurrency(uint32 id, uint32 count) const
|
||||
{
|
||||
PlayerCurrenciesMap::const_iterator itr = _currencyStorage.find(id);
|
||||
return itr != _currencyStorage.end() && itr->second.totalCount >= count;
|
||||
return itr != _currencyStorage.end() && itr->second.Quantity >= count;
|
||||
}
|
||||
|
||||
void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bool ignoreMultipliers/* = false*/)
|
||||
@@ -7147,23 +7120,27 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo
|
||||
if (!ignoreMultipliers)
|
||||
count *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_CURRENCY_GAIN, id);
|
||||
|
||||
int32 precision = currency->Flags & CURRENCY_FLAG_HIGH_PRECISION ? CURRENCY_PRECISION : 1;
|
||||
uint32 oldTotalCount = 0;
|
||||
uint32 oldWeekCount = 0;
|
||||
uint32 oldTrackedCount = 0;
|
||||
|
||||
PlayerCurrenciesMap::iterator itr = _currencyStorage.find(id);
|
||||
if (itr == _currencyStorage.end())
|
||||
{
|
||||
PlayerCurrency cur;
|
||||
cur.state = PLAYERCURRENCY_NEW;
|
||||
cur.totalCount = 0;
|
||||
cur.weekCount = 0;
|
||||
cur.Quantity = 0;
|
||||
cur.WeeklyQuantity = 0;
|
||||
cur.TrackedQuantity = 0;
|
||||
cur.Flags = 0;
|
||||
_currencyStorage[id] = cur;
|
||||
itr = _currencyStorage.find(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
oldTotalCount = itr->second.totalCount;
|
||||
oldWeekCount = itr->second.weekCount;
|
||||
oldTotalCount = itr->second.Quantity;
|
||||
oldWeekCount = itr->second.WeeklyQuantity;
|
||||
oldTrackedCount = itr->second.TrackedQuantity;
|
||||
}
|
||||
|
||||
// count can't be more then weekCap if used (weekCap > 0)
|
||||
@@ -7176,6 +7153,10 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo
|
||||
if (totalCap && count > int32(totalCap))
|
||||
count = totalCap;
|
||||
|
||||
int32 newTrackedCount = int32(oldTrackedCount) + (count > 0 ? count : 0);
|
||||
if (newTrackedCount < 0)
|
||||
newTrackedCount = 0;
|
||||
|
||||
int32 newTotalCount = int32(oldTotalCount) + count;
|
||||
if (newTotalCount < 0)
|
||||
newTotalCount = 0;
|
||||
@@ -7204,8 +7185,9 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo
|
||||
if (itr->second.state != PLAYERCURRENCY_NEW)
|
||||
itr->second.state = PLAYERCURRENCY_CHANGED;
|
||||
|
||||
itr->second.totalCount = newTotalCount;
|
||||
itr->second.weekCount = newWeekCount;
|
||||
itr->second.Quantity = newTotalCount;
|
||||
itr->second.WeeklyQuantity = newWeekCount;
|
||||
itr->second.TrackedQuantity = newTrackedCount;
|
||||
|
||||
if (count > 0)
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CURRENCY, id, count);
|
||||
@@ -7217,20 +7199,15 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket packet(SMSG_UPDATE_CURRENCY, 12);
|
||||
WorldPackets::Misc::SetCurrency packet;
|
||||
packet.Type = id;
|
||||
packet.Quantity = newTotalCount;
|
||||
packet.SuppressChatLog = !printLog;
|
||||
packet.WeeklyQuantity.Set(newWeekCount);
|
||||
packet.TrackedQuantity.Set(newTrackedCount);
|
||||
packet.Flags = itr->second.Flags;
|
||||
|
||||
packet.WriteBit(weekCap != 0);
|
||||
packet.WriteBit(0); // hasSeasonCount
|
||||
packet.WriteBit(!printLog); // print in log
|
||||
|
||||
// if hasSeasonCount packet << uint32(seasontotalearned); TODO: save this in character DB and use it
|
||||
|
||||
packet << uint32(newTotalCount / precision);
|
||||
packet << uint32(id);
|
||||
if (weekCap)
|
||||
packet << uint32(newWeekCount / precision);
|
||||
|
||||
GetSession()->SendPacket(&packet);
|
||||
GetSession()->SendPacket(packet.Write());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7241,8 +7218,10 @@ void Player::SetCurrency(uint32 id, uint32 count, bool /*printLog*/ /*= true*/)
|
||||
{
|
||||
PlayerCurrency cur;
|
||||
cur.state = PLAYERCURRENCY_NEW;
|
||||
cur.totalCount = count;
|
||||
cur.weekCount = 0;
|
||||
cur.Quantity = count;
|
||||
cur.WeeklyQuantity = 0;
|
||||
cur.TrackedQuantity = 0;
|
||||
cur.Flags = 0;
|
||||
_currencyStorage[id] = cur;
|
||||
}
|
||||
}
|
||||
@@ -7273,7 +7252,7 @@ void Player::ResetCurrencyWeekCap()
|
||||
|
||||
for (PlayerCurrenciesMap::iterator itr = _currencyStorage.begin(); itr != _currencyStorage.end(); ++itr)
|
||||
{
|
||||
itr->second.weekCount = 0;
|
||||
itr->second.WeeklyQuantity = 0;
|
||||
itr->second.state = PLAYERCURRENCY_CHANGED;
|
||||
}
|
||||
|
||||
@@ -22860,7 +22839,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
|
||||
m_reputationMgr->SendInitialReputations();
|
||||
/// SMSG_SET_FORCED_REACTIONS
|
||||
m_reputationMgr->SendForceReactions();
|
||||
/// SMSG_INIT_CURRENCY
|
||||
/// SMSG_SETUP_CURRENCY
|
||||
SendCurrencies();
|
||||
/// SMSG_EQUIPMENT_SET_LIST
|
||||
SendEquipmentSetList();
|
||||
|
||||
@@ -177,17 +177,19 @@ struct SpellModifier
|
||||
|
||||
enum PlayerCurrencyState
|
||||
{
|
||||
PLAYERCURRENCY_UNCHANGED = 0,
|
||||
PLAYERCURRENCY_CHANGED = 1,
|
||||
PLAYERCURRENCY_NEW = 2,
|
||||
PLAYERCURRENCY_REMOVED = 3 //not removed just set count == 0
|
||||
PLAYERCURRENCY_UNCHANGED = 0,
|
||||
PLAYERCURRENCY_CHANGED = 1,
|
||||
PLAYERCURRENCY_NEW = 2,
|
||||
PLAYERCURRENCY_REMOVED = 3 //not removed just set count == 0
|
||||
};
|
||||
|
||||
struct PlayerCurrency
|
||||
{
|
||||
PlayerCurrencyState state;
|
||||
uint32 totalCount;
|
||||
uint32 weekCount;
|
||||
PlayerCurrencyState state;
|
||||
uint32 Quantity;
|
||||
uint32 WeeklyQuantity;
|
||||
uint32 TrackedQuantity;
|
||||
uint8 Flags;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<uint32, PlayerTalent*> PlayerTalentMap;
|
||||
@@ -1489,7 +1491,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
* @param id currency entry from CurrencyTypes.dbc
|
||||
* @param count integer value for adding/removing curent currency
|
||||
* @param printLog used on SMSG_UPDATE_CURRENCY
|
||||
* @param printLog used on SMSG_SET_CURRENCY
|
||||
* @param ignore gain multipliers
|
||||
*/
|
||||
void ModifyCurrency(uint32 id, int32 count, bool printLog = true, bool ignoreMultipliers = false);
|
||||
|
||||
@@ -46,11 +46,59 @@ WorldPacket const* WorldPackets::Misc::LoginSetTimeSpeed::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::SetCurrency::Write()
|
||||
{
|
||||
_worldPacket << uint32(Type);
|
||||
_worldPacket << uint32(Quantity);
|
||||
_worldPacket << uint32(Flags);
|
||||
_worldPacket.WriteBit(WeeklyQuantity.HasValue);
|
||||
_worldPacket.WriteBit(TrackedQuantity.HasValue);
|
||||
_worldPacket.WriteBit(SuppressChatLog);
|
||||
|
||||
if (WeeklyQuantity.HasValue)
|
||||
_worldPacket << uint32(WeeklyQuantity.Value);
|
||||
|
||||
if (TrackedQuantity.HasValue)
|
||||
_worldPacket << uint32(TrackedQuantity.Value);
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::SetSelection::Read()
|
||||
{
|
||||
_worldPacket >> Selection;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::SetupCurrency::Write()
|
||||
{
|
||||
_worldPacket << uint32(Data.size());
|
||||
|
||||
for (Record const& data : Data)
|
||||
{
|
||||
_worldPacket << uint32(data.Type);
|
||||
_worldPacket << uint32(data.Quantity);
|
||||
|
||||
_worldPacket.WriteBit(data.WeeklyQuantity.HasValue);
|
||||
_worldPacket.WriteBit(data.MaxWeeklyQuantity.HasValue);
|
||||
_worldPacket.WriteBit(data.TrackedQuantity.HasValue);
|
||||
|
||||
_worldPacket.WriteBits(data.Flags, 5);
|
||||
|
||||
if (data.WeeklyQuantity.HasValue)
|
||||
_worldPacket << uint32(data.WeeklyQuantity.Value);
|
||||
if (data.MaxWeeklyQuantity.HasValue)
|
||||
_worldPacket << uint32(data.MaxWeeklyQuantity.Value);
|
||||
if (data.TrackedQuantity.HasValue)
|
||||
_worldPacket << uint32(data.TrackedQuantity.Value);
|
||||
}
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::ViolenceLevel::Read()
|
||||
{
|
||||
_worldPacket >> ViolenceLvl;
|
||||
|
||||
@@ -64,6 +64,21 @@ namespace WorldPackets
|
||||
int32 GameTimeHolidayOffset = 0;
|
||||
};
|
||||
|
||||
class SetCurrency final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
SetCurrency() : ServerPacket(SMSG_SET_CURRENCY, 12) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
bool SuppressChatLog = false;
|
||||
Optional<int32> TrackedQuantity;
|
||||
int32 Quantity = 0;
|
||||
uint32 Flags = 0;
|
||||
int32 Type = 0;
|
||||
Optional<int32> WeeklyQuantity;
|
||||
};
|
||||
|
||||
class SetSelection final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
@@ -74,6 +89,26 @@ namespace WorldPackets
|
||||
ObjectGuid Selection; ///< Target
|
||||
};
|
||||
|
||||
class SetupCurrency final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
struct Record
|
||||
{
|
||||
int32 Type = 0; // ID from CurrencyTypes.dbc
|
||||
int32 Quantity = 0;
|
||||
Optional<int32> WeeklyQuantity; // Currency count obtained this Week.
|
||||
Optional<int32> MaxWeeklyQuantity; // Weekly Currency cap.
|
||||
Optional<int32> TrackedQuantity;
|
||||
uint8 Flags = 0; // 0 = none,
|
||||
};
|
||||
|
||||
SetupCurrency() : ServerPacket(SMSG_SETUP_CURRENCY, 22) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::vector<Record> Data;
|
||||
};
|
||||
|
||||
class ViolenceLevel final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1026,7 +1026,6 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INITIALIZE_FACTIONS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INITIAL_SETUP, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INITIAL_SPELLS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INIT_CURRENCY, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INIT_WORLD_STATES, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INSPECT_HONOR_STATS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INSPECT_RATED_BG_STATS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
@@ -1305,7 +1304,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SERVER_PERF, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_AI_ANIM_KIT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_ALL_TASK_PROGRESS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_CURRENCY, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_CURRENCY, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_DF_FAST_LAUNCH_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_ATWAR, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_NOT_VISIBLE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
@@ -1323,6 +1322,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_PROFICIENCY, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_PROJECTILE_POSITION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_TIME_ZONE_INFORMATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SETUP_CURRENCY, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SHOWTAXINODES, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SHOW_BANK, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SHOW_MAILBOX, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
@@ -1424,7 +1424,6 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UNIT_SPELLCAST_START, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_ACCOUNT_DATA, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_COMBO_POINTS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_CURRENCY, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_CURRENCY_WEEK_LIMIT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_DUNGEON_ENCOUNTER_FOR_LOOT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
|
||||
@@ -1016,7 +1016,6 @@ enum OpcodeServer : uint32
|
||||
SMSG_INITIALIZE_FACTIONS = 0x0B10,
|
||||
SMSG_INITIAL_SETUP = 0x0B07,
|
||||
SMSG_INITIAL_SPELLS = 0x0A81,
|
||||
SMSG_INIT_CURRENCY = 0x0B06,
|
||||
SMSG_INIT_WORLD_STATES = 0x0B04,
|
||||
SMSG_INSPECT = 0xBADD,
|
||||
SMSG_INSPECT_HONOR_STATS = 0xBADD,
|
||||
@@ -1327,6 +1326,7 @@ enum OpcodeServer : uint32
|
||||
SMSG_SET_PROJECTILE_POSITION = 0xBADD,
|
||||
SMSG_SET_TIME_ZONE_INFORMATION = 0x153E,
|
||||
SMSG_SET_VIGNETTE = 0x09AC,
|
||||
SMSG_SETUP_CURRENCY = 0x0B06,
|
||||
SMSG_SHOWTAXINODES = 0x12A1,
|
||||
SMSG_SHOW_BANK = 0x0204,
|
||||
SMSG_SHOW_MAILBOX = 0xBADD,
|
||||
@@ -1429,7 +1429,6 @@ enum OpcodeServer : uint32
|
||||
SMSG_UNIT_SPELLCAST_START = 0xBADD,
|
||||
SMSG_UPDATE_ACCOUNT_DATA = 0x1520,
|
||||
SMSG_UPDATE_COMBO_POINTS = 0xBADD,
|
||||
SMSG_UPDATE_CURRENCY = 0xBADD,
|
||||
SMSG_UPDATE_CURRENCY_WEEK_LIMIT = 0xBADD,
|
||||
SMSG_UPDATE_DUNGEON_ENCOUNTER_FOR_LOOT = 0xBADD,
|
||||
SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT = 0xBADD,
|
||||
|
||||
@@ -264,9 +264,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
|
||||
// Currency
|
||||
PrepareStatement(CHAR_SEL_PLAYER_CURRENCY, "SELECT currency, week_count, total_count FROM character_currency WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_PLAYER_CURRENCY, "UPDATE character_currency SET week_count = ?, total_count = ? WHERE guid = ? AND currency = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_PLAYER_CURRENCY, "REPLACE INTO character_currency (guid, currency, week_count, total_count) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_PLAYER_CURRENCY, "SELECT Currency, Quantity, WeeklyQuantity, TrackedQuantity, Flags FROM character_currency WHERE CharacterGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_PLAYER_CURRENCY, "UPDATE character_currency SET Quantity = ?, WeeklyQuantity = ?, TrackedQuantity = ?, Flags = ? WHERE CharacterGuid = ? AND Currency = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_PLAYER_CURRENCY, "REPLACE INTO character_currency (CharacterGuid, Currency, Quantity, WeeklyQuantity, TrackedQuantity, Flags) VALUES (?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
|
||||
// Account data
|
||||
PrepareStatement(CHAR_SEL_ACCOUNT_DATA, "SELECT type, time, data FROM account_data WHERE accountId = ?", CONNECTION_SYNCH);
|
||||
|
||||
Reference in New Issue
Block a user