|
||
|
|||||||
| PlayUO (Krrios' Client) Support & Etc for Krrios's UO Client. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Join Date: Apr 2005
Age: 49
Posts: 19
|
Hi there.
Im trying to write a plugin, that calculates the price of an item using a database server. Anyone can tell me how I can show up a target selector. I mean that the mouse cursor switches to the targeting symbol and the user can click on an item to choose it. ![]() Thank you very much for your help. Greetings from Europe |
|
|
|
|
|
#2 (permalink) |
|
Join Date: Apr 2005
Age: 49
Posts: 19
|
Hi, I just began so there is almost nothing.
Code:
public class PriceCalc : Plugin
{
public override bool OnCommandEntered(string s)
{
if(s == ". price")
{
Client.Engine.AddTextMessage("Select Item");
Client.Engine.AddTarget();
}
return base.OnCommandEntered (s);
}
}
![]() |
|
|
|
|
|
#3 (permalink) |
|
Join Date: Dec 2005
Posts: 1
|
I don't look on here very often.. So don't expect a quick reply to any questions.
But you need to make a new object that implements Client.Targeting.ITargetHandler It will need to have a constructor (can just be blank) void OnTarget(object) void OnCancel(TargetCancelType) The onTarget will recieve the object that is targeted. You should check that is it an Item before typecasting it. Then you will need to make an object with Plugin as the parent, just like you already have. But instead of Engine.AddTarget, you will need Engine.TargetHandler = new MyTargetHandler(); Ok? |
|
|
|
|
|
#4 (permalink) |
|
Account Terminated
Join Date: Sep 2002
Location: New York
Age: 22
Posts: 476
|
I'll help by offering some rough code;
Code:
class FindItemPrice : Plugin
{
public override bool OnCommandEntered(string s)
{
if (s == ". getitemprice")
{
Engine.AddTextMessage("Target the items whos price you'd like to get.");
Engine.TargetHandler = new CustomTargetHandler();
}
return base.OnCommandEntered(s);
}
}
class CustomTargetHandler : ITargetHandler
{
public void OnCancel(TargetCancelType why)
{
}
public void OnTarget(object targeted)
{
Item targetedItem;
if (targeted is Item)
{
targetedItem = targeted as Item;
// Do your stuff here.
}
else
Engine.AddTextMessage("That is not an item.");
}
}
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|