slaw
Software Developer
WARNING:
After some tests, I see it isnt working correctly. Player cant wear any outfits in some cases. So. USE AT YOUR OWN RISK, or wait until I'll fix it ^_^
NOTICE:
If you're using TFS 0.3 then this code is already included. Just leave this topic. ;P
Based on storagevalues.
Eq. if player have storage value (40000 + looktype) (Eq. 40128 for citizen) == 1 and in outfits.xml addon is set to only from quest available then he will be able to wear it. Else, if quest isnt set to available only from quest, then all are avaible to wear it (of course if have premium or addons if setted).
Outfit.cpp
After:
Add:
Change:
To:
In same function, change:
To:
After:
Add:
After:
Add:
Outfit.h
After:
Add:
Change:
To:
protocolgame.cpp
Change:
To:
Change:
To:
player.cpp
Change:
To:
Change:
To:
Now, if you want to be some outfits was enabled only from quests you must add to outfits.xml: questOnly="1". All outfits are default set to questOnly="0".
Now, create any lua script with: setPlayerStorageValue(cid, 40129, 1) (129 - hunter outfit)
After some tests, I see it isnt working correctly. Player cant wear any outfits in some cases. So. USE AT YOUR OWN RISK, or wait until I'll fix it ^_^
NOTICE:
If you're using TFS 0.3 then this code is already included. Just leave this topic. ;P
Based on storagevalues.
Eq. if player have storage value (40000 + looktype) (Eq. 40128 for citizen) == 1 and in outfits.xml addon is set to only from quest available then he will be able to wear it. Else, if quest isnt set to available only from quest, then all are avaible to wear it (of course if have premium or addons if setted).
Outfit.cpp
After:
PHP:
new_outfit->premium = outfit.premium;
PHP:
new_outfit->quest = outfit.quest;
Change:
PHP:
bool OutfitList::isInList(uint32_t looktype, uint32_t addons, bool playerPremium, int32_t playerSex) const
PHP:
bool OutfitList::isInList(uint32_t looktype, uint32_t addons, bool playerPremium, int32_t playerSex, int32_t playerStorage) const
In same function, change:
PHP:
if((*it)->premium && playerPremium || !(*it)->premium)
return true;
PHP:
if((*it)->premium && playerPremium || !(*it)->premium)
{
if((*it)->quest && playerStorage || !(*it)->quest)
return true;
}
return false;
After:
PHP:
//build default outfit lists
outfit.addons = 0;
PHP:
outfit.quest = false;
After:
PHP:
if(readXMLInteger(p, "enabled", intVal))
outfitEnabled = (intVal == 1);
PHP:
if(readXMLInteger(p, "questOnly", intVal))
outfit.quest = (intVal == 1);
else
outfit.quest = false;
Outfit.h
After:
PHP:
uint32_t looktype;
uint32_t addons;
PHP:
uint32_t quest;
Change:
PHP:
bool isInList(uint32_t looktype, uint32_t addons, bool playerPremium, int32_t playerSex) const;
PHP:
bool isInList(uint32_t looktype, uint32_t addons, bool playerPremium, int32_t playerSex, int32_t playerStorage) const;
protocolgame.cpp
Change:
PHP:
OutfitListType::const_iterator it, it_;
for(it = global_outfits.begin(); it != global_outfits.end(); ++it)
{
if((*it)->premium && !player->isPremium())
count_outfits--;
}
PHP:
OutfitListType::const_iterator it, it_;
for(it = global_outfits.begin(); it != global_outfits.end(); ++it)
{
int32_t value;
player->getStorageValue((40000 + (*it)->looktype), value);
if(((*it)->premium && !player->isPremium()) || ((*it)->quest && !(value==1)))
count_outfits--;
}
Change:
PHP:
for(it = global_outfits.begin(); it != global_outfits.end() && (count_outfits > 0); ++it)
{
if((*it)->premium && player->isPremium() || !(*it)->premium)
{
addedAddon = false;
msg->AddU16((*it)->looktype);
msg->AddString(Outfits::getInstance()->getOutfitName((*it)->looktype));
//TODO: Try to avoid using loop to get addons
for(it_ = player_outfits.begin(); it_ != player_outfits.end(); ++it_)
{
if((*it_)->looktype == (*it)->looktype)
{
msg->AddByte((*it_)->addons);
addedAddon = true;
break;
}
}
if(!addedAddon)
msg->AddByte(0x00);
count_outfits--;
}
}
PHP:
for(it = global_outfits.begin(); it != global_outfits.end() && (count_outfits > 0); ++it)
{
if((*it)->premium && player->isPremium() || !(*it)->premium)
{
int32_t value;
player->getStorageValue((40000 + (*it)->looktype), value);
if((*it)->quest && (value == 1) || !(*it)->quest)
{
addedAddon = false;
msg->AddU16((*it)->looktype);
msg->AddString(Outfits::getInstance()->getOutfitName((*it)->looktype));
//TODO: Try to avoid using loop to get addons
for(it_ = player_outfits.begin(); it_ != player_outfits.end(); ++it_)
{
if((*it_)->looktype == (*it)->looktype)
{
msg->AddByte((*it_)->addons);
addedAddon = true;
break;
}
}
if(!addedAddon)
msg->AddByte(0x00);
count_outfits--;
}
}
}
player.cpp
Change:
PHP:
return m_playerOutfits.isInList(_looktype, _addons, isPremium(), getSex());
PHP:
int32_t value;
getStorageValue(40000 + _looktype, value);
return m_playerOutfits.isInList(_looktype, _addons, isPremium(), getSex(), value);
Change:
PHP:
if(!global_outfits.isInList(looktype, addons, isPremium(), getSex()))
PHP:
int32_t value;
getStorageValue(40000 + looktype, value);
if(!global_outfits.isInList(looktype, addons, isPremium(), getSex(), value))
Now, if you want to be some outfits was enabled only from quests you must add to outfits.xml: questOnly="1". All outfits are default set to questOnly="0".
Now, create any lua script with: setPlayerStorageValue(cid, 40129, 1) (129 - hunter outfit)
Last edited: