Feature Auto recharge ammo

xydius

Just an otland wanderer
Joined
Feb 25, 2016
Messages
43
Reaction score
30
This should have a condition that works only for paladins.
what for? i mean i dont think a knight would use a bow and arrows, also that restriction can be made on movements onequip so only pallys use bows and xbows
 

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,772
Reaction score
206
Location
Chile, Santiago
If I am a kngiht, and I loot ammunition from corpses, they will be auto equiped xD
 
OP
Joe Rod

Joe Rod

JoeRod #1189
Joined
Mar 16, 2011
Messages
485
Reaction score
112
Code:
uint32_t count = item->getItemCount();
if (count - 1 == 0)
{
   uint32_t playerCount = player->getItemTypeCount(item->getID(), -1);
   playerCount--;
   if (playerCount > 0)
   {
       int32_t removeCount = std::max<int32_t>(1, std::min<int32_t>(100, playerCount));             
       bool test = player->removeItemOfType(item->getID(), removeCount, -1, true);
       if (test)   
       {
           g_game.transformItem(item, item->getID(), removeCount);
           std::ostringstream ss;
          
           ss << "Your " << item->getPluralName() << " were charged.";
          
           player->sendTextMessage(MESSAGE_STATUS_SMALL, ss.str());
              break;
       }   
      
   }            
}
solved two bugs:
  • It was not deep searching
  • It was not removing items from store inbox
Thanks to @StreamSide for report it and @Mkalo for answer me a doubt

@cbrm @Cornex @Red or another mod
edit main post plz. Thanks in advance
 

LightTenshimaru

LightTenshimaru
Joined
Mar 15, 2014
Messages
29
Reaction score
1
Works like a charm, thanks for the awesome script.
There's a way to make Spears and T. Stars rechargeable too?

Thanks...
 
Top