using System;
using Server;
using Server.Targeting;
using Server.Mobiles;
using Server.Network;
using Server.Items;
using Server.Gumps;
using System.Collections;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Commands;
namespace Server.SkillHandlers
{
public class Modify_Item : Item
{
[Constructable]
public Modify_Item()
: base(0xED4)
{
Movable = false;
Hue = 0xB83;
Name = "A Item Modificator";
}
// Here on click to open the gump
}
public class Modify_ItemGump : Gump
{
public Modify_ItemGump(Mobile from)
: base(80, 80)
{
Mobile m = from;
PlayerMobile pm = from as PlayerMobile;
pm.Imbue_ModVal = 0;
pm.ImbMenu_Cat = 0;
AddPage(0);
this.AddBackground(0, 0, 200, 200, 9270);
this.AddAlphaRegion(12, 12, 486, 20);
this.AddAlphaRegion(12, 40, 486, 247);
this.AddAlphaRegion(12, 199, 486, 25);
this.AddLabel(221, 18, 1359, "MODIFY ITEM MENU");
AddButton(25, 66, 4005, 4006, 10002, GumpButtonType.Reply, 0);
AddHtml(66, 68, 430, 18, "<BASEFONT COLOR=#FFFFFF>Adds an item property on an item", false, false);
AddButton(25, 95, 4005, 4006, 10003, GumpButtonType.Reply, 0);
AddHtml(66, 97, 430, 18, "<BASEFONT COLOR=#FFFFFF>Removes an item property on an item", false, false);
AddButton(19, 301, 4020, 4021, 10001, GumpButtonType.Reply, 0);
this.AddLabel(58, 302, 1359, "CLOSE");
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
PlayerMobile pm = from as PlayerMobile;
int buttonNum = 0;
if (info.ButtonID > 0 && info.ButtonID < 10000)
buttonNum = 1;
else if (info.ButtonID > 20004)
buttonNum = 30000;
else
buttonNum = info.ButtonID;
switch (buttonNum)
{
case 10001: // = Close button
{
break;
}
case 10002: // = Adds an item property on an item
{
from.CloseGump(typeof(Modify_ItemGump));
from.SendMessage("Target a item to add a propertie.");
from.Target = new InternalTarget();
break;
}
case 10003: // = Removes an item property on an item
{
from.CloseGump(typeof(Modify_ItemGump));
from.SendMessage("Target a item to remove a propertie.");
from.Target = new InternalTarget();
break;
}
}
return;
}
// ===== Targetting Item =====
private class InternalTarget : Target
{
public InternalTarget()
: base(1, false, TargetFlags.None)
{
AllowNonlocal = true;
}
protected override void OnTarget(Mobile from, object o)
{
PlayerMobile pm = from as PlayerMobile;
int Irf = Modify_ItemGump.GetItemRef(o);
return;
}
}
public static int GetItemRef(object i)
{
int item_type = 0;
if (i is BaseWeapon)
{
item_type = 1;
}
if (i is BaseRanged)
{
item_type = 2;
}
if (i is BaseArmor)
{
item_type = 3;
}
if (i is BaseShield)
{
item_type = 4;
}
if (i is BaseHat)
{
item_type = 5;
}
if (i is BaseJewel)
{
item_type = 6;
}
return item_type;
// HERE IS WHERE I TRY TO GET CRAFTRESOURCES
// item Craftresources --> number
// Example
// if item_type = 3 && CraftresourcesNumber = 102 --> Remove 40 Luck from item
//CraftResource (Enum)
//None = 0,
//Iron = 1,
//DullCopper = 2,
//ShadowIron = 3,
//Copper = 4,
//Bronze = 5,
//Gold = 6,
//Agapite = 7,
//Verite = 8,
//Valorite = 9,
//RegularLeather = 101,
//SpinedLeather = 102,
//HornedLeather = 103,
//BarbedLeather = 104,
//RedScales = 201,
//YellowScales = 202,
//BlackScales = 203,
//GreenScales = 204,
//WhiteScales = 205,
//BlueScales = 206,
//RegularWood = 301,
//OakWood = 302,
//AshWood = 303,
//YewWood = 304,
//Heartwood = 305,
//Bloodwood = 306,
//Frostwood = 307
}
}
}