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
파일 보기 프로젝트 열기: aura-project/aura 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
_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