C# Класс Aura.Channel.Scripting.Scripts.NpcShopScript

Represents a regular NPC shop.
The difference between a gold and a ducat shop is: none. The secret lies in the DucatPrice value of ItemOptionInfo. If it is > 0, the client shows that, instead of the gold price, and assumes that you're paying with ducats. TODO: Find the best way to add ducat items. Mixing the two should be possible I suppose. AddItem/AddDucatItem? Selling items always uses gold (option to sell for ducats?). Aside from Ducats and Gold there are two more currencies, Stars and Pons. The client will show the buy currency based on the values set, Duncan > Stars > Gold. Pons overweights everything, but it's displayed alongside other prices if they aren't 0.
Наследование: IScript, IDisposable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_tabs NpcShopTab>.Dictionary

Открытые методы

Метод Описание
Add ( string tabTitle, Func shouldDisplay = null ) : NpcShopTab

Adds empty tab.

Add ( string tabTitle, bool randomizeColors, Func shouldDisplay = null ) : NpcShopTab

Adds empty tab.

Add ( ) : void

Adds empty tabs.

Add ( string tabTitle, Item item, int price, int stock ) : void

Adds item to tab.

Add ( string tabTitle, int itemId, int amount = 1, int price = -1, int stock = -1 ) : void

Adds item to tab.

Add ( string tabTitle, int itemId, string metaData, int price = -1, int stock = -1 ) : void

Adds item to tab.

Add ( string tabTitle, int itemId, uint color1, uint color2, uint color3, int price = -1, int stock = -1 ) : void

Adds item to tab.

AddQuest ( string tabTitle, int questId, int price, int stock = -1 ) : void

Adds quest scroll item to tab.

Buy ( Creature creature, long itemEntityId, bool moveToInventory, bool directBankTransaction ) : bool

ClearTab ( string tabTitle ) : bool

Removes all items from tab.

This, just like adding items at run-time, does not live update the currently open shops. Afaik it's not on officials either, but it would be possible, if we create a list of open shop instances and use the clear and fill shop packets.

Dispose ( ) : void

Unsubscribes Shop from events.

Init ( ) : bool

Initializes shop, calling setup and adding it to the script manager.

NpcShopScript ( ) : System

Creates new NpcShopScript

OpenFor ( Creature creature, NPC owner ) : void

Sends OpenNpcShop for creature and this shop.

OpenRemotelyFor ( Creature creature ) : void

Sends OpenShopRemotelyR and OpenNpcShop for creature and this shop.

SetPaymentMethod ( string tabTitle, PaymentMethod method ) : void

Sets the payment method for the given tab.

Setup ( ) : void

Called when creating the shop.

Защищенные методы

Метод Описание
GetOrCreateTab ( string tabTitle ) : NpcShopTab

Returns the given tab, after creating if necessary.

GetTabs ( ) : IList

Returns thread-safe list of all tabs.

GetTabs ( Creature creature, NPC owner ) : IList

Returns thread-safe list of visible tabs, or all tabs if one of the parameters is null.

TODO: This could be cached.

OnErinnMidnightTick ( ErinnTime time ) : void

Called at midnight (Erinn time).

RandomizeItemColors ( ) : void

Randomizes colors of all items in all tabs.

Приватные методы

Метод Описание
GetItem ( long entityId ) : Item

Returns item from one of the tabs by id. or null.

Описание методов

Add() публичный Метод

Adds empty tab.
public Add ( string tabTitle, Func shouldDisplay = null ) : NpcShopTab
tabTitle string Tab title displayed in-game
shouldDisplay Func Function that determines whether tab should be displayed, set null if not used.
Результат NpcShopTab

Add() публичный Метод

Adds empty tab.
public Add ( string tabTitle, bool randomizeColors, Func shouldDisplay = null ) : NpcShopTab
tabTitle string Tab title displayed in-game
randomizeColors bool Determines whether item colors are randomized on midnight.
shouldDisplay Func Function that determines whether tab should be displayed, set null if not used.
Результат NpcShopTab

Add() публичный Метод

Adds empty tabs.
public Add ( ) : void
Результат void

Add() публичный Метод

Adds item to tab.
public Add ( string tabTitle, Item item, int price, int stock ) : void
tabTitle string
item Item
price int Uses db value if lower than 0.
stock int Amount of times item can be bough, unlimited if lower than 0.
Результат void

Add() публичный Метод

Adds item to tab.
public Add ( string tabTitle, int itemId, int amount = 1, int price = -1, int stock = -1 ) : void
tabTitle string
itemId int
amount int
price int Uses db value if lower than 0 (default).
stock int Amount of times item can be bough, unlimited if lower than 0 (default).
Результат void

Add() публичный Метод

Adds item to tab.
public Add ( string tabTitle, int itemId, string metaData, int price = -1, int stock = -1 ) : void
tabTitle string
itemId int
metaData string
price int Uses db value if lower than 0 (default).
stock int Amount of times item can be bough, unlimited if lower than 0 (default).
Результат void

Add() публичный Метод

Adds item to tab.
public Add ( string tabTitle, int itemId, uint color1, uint color2, uint color3, int price = -1, int stock = -1 ) : void
tabTitle string
itemId int
color1 uint
color2 uint
color3 uint
price int Uses db value if lower than 0 (default).
stock int Amount of times item can be bough, unlimited if lower than 0 (default).
Результат void

AddQuest() публичный Метод

Adds quest scroll item to tab.
public AddQuest ( string tabTitle, int questId, int price, int stock = -1 ) : void
tabTitle string
questId int
price int
stock int Amount of times item can be bough, unlimited if lower than 0 (default).
Результат void

Buy() публичный Метод

public Buy ( Creature creature, long itemEntityId, bool moveToInventory, bool directBankTransaction ) : bool
creature Aura.Channel.World.Entities.Creature
itemEntityId long
moveToInventory bool
directBankTransaction bool
Результат bool

ClearTab() публичный Метод

Removes all items from tab.
This, just like adding items at run-time, does not live update the currently open shops. Afaik it's not on officials either, but it would be possible, if we create a list of open shop instances and use the clear and fill shop packets.
public ClearTab ( string tabTitle ) : bool
tabTitle string
Результат bool

Dispose() публичный Метод

Unsubscribes Shop from events.
public Dispose ( ) : void
Результат void

GetOrCreateTab() защищенный Метод

Returns the given tab, after creating if necessary.
protected GetOrCreateTab ( string tabTitle ) : NpcShopTab
tabTitle string
Результат NpcShopTab

GetTabs() защищенный Метод

Returns thread-safe list of all tabs.
protected GetTabs ( ) : IList
Результат IList

GetTabs() защищенный Метод

Returns thread-safe list of visible tabs, or all tabs if one of the parameters is null.
TODO: This could be cached.
protected GetTabs ( Creature creature, NPC owner ) : IList
creature Aura.Channel.World.Entities.Creature Creature opening the shop
owner Aura.Channel.World.Entities.NPC NPC owning the shop
Результат IList

Init() публичный Метод

Initializes shop, calling setup and adding it to the script manager.
public Init ( ) : bool
Результат bool

NpcShopScript() публичный Метод

Creates new NpcShopScript
public NpcShopScript ( ) : System
Результат System

OnErinnMidnightTick() защищенный Метод

Called at midnight (Erinn time).
protected OnErinnMidnightTick ( ErinnTime time ) : void
time Aura.Mabi.ErinnTime
Результат void

OpenFor() публичный Метод

Sends OpenNpcShop for creature and this shop.
public OpenFor ( Creature creature, NPC owner ) : void
creature Aura.Channel.World.Entities.Creature Creature opening the shop
owner Aura.Channel.World.Entities.NPC NPC owning the shop
Результат void

OpenRemotelyFor() публичный Метод

Sends OpenShopRemotelyR and OpenNpcShop for creature and this shop.
public OpenRemotelyFor ( Creature creature ) : void
creature Aura.Channel.World.Entities.Creature Creature opening the shop
Результат void

RandomizeItemColors() защищенный Метод

Randomizes colors of all items in all tabs.
protected RandomizeItemColors ( ) : void
Результат void

SetPaymentMethod() публичный Метод

Sets the payment method for the given tab.
public SetPaymentMethod ( string tabTitle, PaymentMethod method ) : void
tabTitle string
method PaymentMethod
Результат void

Setup() публичный Метод

Called when creating the shop.
public Setup ( ) : void
Результат void

Описание свойств

_tabs защищенное свойство

protected Dictionary _tabs
Результат NpcShopTab>.Dictionary