Post[FSOD] Restricting Donors Certain Items :)

Posts 1–4 of 4 · Page 1 of 1
[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
Code:
 DonorRestricted = elem.Element("DonorRestricted") != null;
above
Code:
 Description = elem.Element("Description").Value;
Step 2.
Add a bool called "DonorRestricted", Still in Descriptors.cs file
Code:
 public bool DonorRestricted { get; private set; }
above
Code:
 public string Description { get; private set; }
Step 3.

Add this to your Item XML. Update the item in client aswell!

Code:
  <DonorRestricted/>
here's a example:

 
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!
Quote Originally Posted by SSGotenks View Post
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
Code:
 DonorRestricted = elem.Element("DonorRestricted") != null;
above
Code:
 Description = elem.Element("Description").Value;
Step 2.
Add a bool called "DonorRestricted", Still in Descriptors.cs file
Code:
 public bool DonorRestricted { get; private set; }
above
Code:
 public string Description { get; private set; }
Step 3.

Add this to your Item XML. Update the item in client aswell!

Code:
  <DonorRestricted/>
here's a example:

 
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!
Thanks this is exactly what I needed!
Quote Originally Posted by SSGotenks View Post
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
Code:
 DonorRestricted = elem.Element("DonorRestricted") != null;
above
Code:
 Description = elem.Element("Description").Value;
Step 2.
Add a bool called "DonorRestricted", Still in Descriptors.cs file
Code:
 public bool DonorRestricted { get; private set; }
above
Code:
 public string Description { get; private set; }
Step 3.

Add this to your Item XML. Update the item in client aswell!

Code:
  <DonorRestricted/>
here's a example:

 
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!
Dammit i cannot understand this tutorial http://prntscr.com/fiijmt
Quote Originally Posted by LiveDEMI View Post
Dammit i cannot understand this tutorial http://prntscr.com/fiijmtⓘ
i think this is pretty straight forward ? :3 add me on skype for help Arenal89
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us