[FSOD] Restricting Donors Certain Items :)
Alright, So ManKindGaming requested this had spare time left so I set up a FSOD + AS3 and took me 5 mins to make. Enjoy
Step 1.
Add this line of code onto your Descriptors.cs file
above
Step 2.
Add a bool called "DonorRestricted", Still in Descriptors.cs file
above
Step 3.
Add this to your Item XML. Update the item in client aswell!
here's a example:
Step 4.
Now In AdminCommands.cs file update your GiveCommand.
Change if (player.Client.Account.Rank == 3) //change this to your donor rank!
Enjoy!
Step 1.
Add this line of code onto your Descriptors.cs file
Code:
DonorRestricted = elem.Element("DonorRestricted") != null;
Code:
Description = elem.Element("Description").Value;
Add a bool called "DonorRestricted", Still in Descriptors.cs file
Code:
public bool DonorRestricted { get; private set; }
Code:
public string Description { get; private set; }
Add this to your Item XML. Update the item in client aswell!
Code:
<DonorRestricted/>
Example
Code:
<Object type="0xb0b" id="Sword of Acclaim">
<Class>Equipment</Class>
<Item/>
<Texture>
<File>lofiObj5</File>
<Index>0x3c</Index>
</Texture>
<SlotType>1</SlotType>
<Tier>12</Tier>
<Description>{equip.A_great_sword_of_recognition,_forged_by_the_gods_for_the_ch}</Description>
<RateOfFire>1</RateOfFire>
<Sound>weapon/mithril_sword</Sound>
<Projectile>
<ObjectId>Purple Bolt</ObjectId>
<Speed>100</Speed>
<MinDamage>220</MinDamage>
<MaxDamage>275</MaxDamage>
<LifetimeMS>350</LifetimeMS>
</Projectile>
<BagType>4</BagType>
<FameBonus>4</FameBonus>
<OldSound>bladeSwing</OldSound>
<DonorRestricted/>
<feedPower>450</feedPower>
<DisplayId>{equip.Sword_of_Acclaim}</DisplayId>
</Object>
Step 4.
Now In AdminCommands.cs file update your GiveCommand.
Updated GiveCommand
Code:
internal class GiveCommand : Command
{
public GiveCommand()
: base("give", 1)
{
}
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (args.Length == 0)
{
player.SendHelp("Usage: /give <Itemname>");
return false;
}
string name = string.Join(" ", args.ToArray()).Trim();
ushort objType;
//creates a new case insensitive dictionary based on the XmlDatas
Dictionary<string, ushort> icdatas = new Dictionary<string, ushort>(player.Manager.GameData.IdToObjectType,
StringComparer.OrdinalIgnoreCase);
if (!icdatas.TryGetValue(name, out objType))
{
player.SendError("Unknown type!");
return false;
}
if (player.Client.Account.Rank == 3) //change this to your donor rank!
{
if (player.Manager.GameData.Items[objType].DonorRestricted)
{
player.SendError("No no! Item is restricted by Gotenks!!!");
return false;
}
}
if (!player.Manager.GameData.Items[objType].Secret || player.Client.Account.Rank >= 4)
{
for (int i = 0; i < player.Inventory.Length; i++)
if (player.Inventory[i] == null)
{
player.Inventory[i] = player.Manager.GameData.Items[objType];
player.UpdateCount++;
player.SaveToCharacter();
player.SendInfo("Success!");
break;
}
}
else
{
player.SendError("Item cannot be given!");
return false;
}
return true;
}
}
Change if (player.Client.Account.Rank == 3) //change this to your donor rank!
Enjoy!
