コード例 #1
0
ファイル: Item.cpp プロジェクト: Splash/mangos
bool Item::LoadSoulboundTradeableDataFromDB(Player* owner)
{
    QueryResult* result = CharacterDatabase.PQuery("SELECT allowedPlayers FROM item_soulbound_trade_data WHERE itemGuid = %u", GetGUIDLow());
    if (result)
    {
        Field* fields = result->Fetch();
        std::string guidsStr = fields[0].GetCppString();
        delete result;

        Tokens guidList(guidsStr, ' ');

        AllowedLooterSet looters;
        for (Tokens::iterator itr = guidList.begin(); itr != guidList.end(); ++itr)
            looters.insert(atol(*itr));

        if (!looters.empty())
            SetSoulboundTradeable(owner, &looters, true);
        else
            SetNotSoulboundTradeable(owner, true);

        return !looters.empty();
    }
    else
    {
        SetNotSoulboundTradeable(owner, true);
        return false;
    }
}
コード例 #2
0
ファイル: Item.cpp プロジェクト: rexy/ArkCORE
bool Item::CheckSoulboundTradeExpire() {
	// called from owner's update - GetOwner() MUST be valid
	if (GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + 2 * HOUR
			< GetOwner()->GetTotalPlayedTime()) {
		SetSoulboundTradeable(NULL, GetOwner(), false);
		return true; // remove from tradeable list
	}

	return false;
}