GoMissing causes the pet to go absent for the given number of rounds. Pass 0 to return the pet immediately, firing PetReturn instead of PetLeave. Any positive value fires PetLeave and begins the countdown.
(rounds int)
| 133 | // Pass 0 to return the pet immediately, firing PetReturn instead of PetLeave. |
| 134 | // Any positive value fires PetLeave and begins the countdown. |
| 135 | func (p ScriptPet) GoMissing(rounds int) { |
| 136 | if p.petRecord == nil { |
| 137 | return |
| 138 | } |
| 139 | if rounds <= 0 { |
| 140 | if !p.petRecord.IsMissing() { |
| 141 | return |
| 142 | } |
| 143 | p.petRecord.GoMissing(0) |
| 144 | if p.userId > 0 { |
| 145 | TryPetScriptEvent(`PetReturn`, p.userId) |
| 146 | } |
| 147 | return |
| 148 | } |
| 149 | if !p.petRecord.IsMissing() { |
| 150 | p.petRecord.GoMissing(rounds) |
| 151 | if p.userId > 0 { |
| 152 | TryPetScriptEvent(`PetLeave`, p.userId) |
| 153 | } |
| 154 | } else { |
| 155 | p.petRecord.GoMissing(rounds) |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | // HasScript returns true if this pet type has a script file on disk. |
| 160 | func (p ScriptPet) HasScript() bool { |
nothing calls this directly
no test coverage detected