GetPet returns a ScriptPet wrapping the given pet pointer. Returns nil if pet is nil or does not exist. Pass the owner's userId as the optional second argument to enable script-triggered events such as GoMissing.
(pet *pets.Pet, userId ...int)
| 182 | // Pass the owner's userId as the optional second argument to enable |
| 183 | // script-triggered events such as GoMissing. |
| 184 | func GetPet(pet *pets.Pet, userId ...int) *ScriptPet { |
| 185 | if pet == nil || !pet.Exists() { |
| 186 | return nil |
| 187 | } |
| 188 | sp := &ScriptPet{petRecord: pet} |
| 189 | if len(userId) > 0 { |
| 190 | sp.userId = userId[0] |
| 191 | } |
| 192 | return sp |
| 193 | } |
| 194 | |
| 195 | // //////////////////////////////////////////////////////// |
| 196 | // |
no test coverage detected