fix: slot notification
This commit is contained in:
parent
021c155273
commit
e79b82a831
5 changed files with 13 additions and 11 deletions
|
@ -68,6 +68,8 @@ func OnNEP17Payment(from interop.Hash160, amount int, data any) {
|
|||
|
||||
func gasTransfer(playerOwner interop.Hash160, gasCount int) {
|
||||
contractHash := runtime.GetExecutingScriptHash()
|
||||
|
||||
|
||||
transferredGas := gas.Transfer(playerOwner, contractHash, gasCount, nil)
|
||||
|
||||
if !transferredGas {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"name":"SlotMashine","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":458,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"rollSlot","offset":95,"parameters":[{"name":"bet","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"SlotResult","parameters":[{"name":"array","type":"Array"}]},{"name":"playerBalance","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}
|
||||
{"name":"SlotMashine","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":457,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"rollSlot","offset":95,"parameters":[{"name":"bet","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"SlotResult","parameters":[{"name":"array","type":"Array"}]},{"name":"playerBalance","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}
|
|
@ -1,16 +1,16 @@
|
|||
name: SlotMashine
|
||||
supportedstandards: []
|
||||
events:
|
||||
- name: "SlotResult"
|
||||
- name: SlotResult
|
||||
parameters:
|
||||
- name: "array"
|
||||
type: "Array"
|
||||
- name: "playerBalance"
|
||||
- name: array
|
||||
type: Array
|
||||
- name: playerBalance
|
||||
parameters:
|
||||
- name: "int"
|
||||
type: "Integer"
|
||||
- name: int
|
||||
type: Integer
|
||||
permissions:
|
||||
- methods: '*'
|
||||
events:
|
||||
- "SlotResult"
|
||||
- "playerBalance"
|
||||
- SlotResult
|
||||
- playerBalance
|
||||
|
|
|
@ -56,10 +56,10 @@ func RollSlot(bet int) {
|
|||
}
|
||||
|
||||
func roll() int {
|
||||
var result [3]int
|
||||
var result []int
|
||||
for i:=0; i<3; i++ {
|
||||
wheel := (runtime.GetRandom() % 8) + 1
|
||||
result[i] = wheel
|
||||
result = append(result, wheel)
|
||||
runtime.Log("WheelNumber=" + string(i + 1) +", value="+string(wheel))
|
||||
}
|
||||
runtime.Notify("SlotResult", result)
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue