/// <summary> /// Attepts to handle the current operation /// </summary> public static OperationResult HandleGameOperation(string operation, params object[] args) { var callingScript = ExecutionEngine.CallingScriptHash; var result = new OperationResult { IsComplete = true }; if (operation == "getIsPregnant") { if (args.Length != 1) { result.Value = 0; return(result); } BigInteger tokenId = (BigInteger)args[0]; result.Value = GameOperations.IsPregnant(tokenId); } else if (operation == "getCanBreedWithById") { if (args.Length != 2) { result.Value = 0; return(result); } BigInteger motherId = (BigInteger)args[0]; BigInteger fatherId = (BigInteger)args[1]; result.Value = GameOperations.CanBreedWithById(motherId, fatherId); } else if (operation == "getIsCloneApplySucc") { if (args.Length != 1) { result.Value = 0; return(result); } BigInteger tokenId = (BigInteger)args[0]; result.Value = GameOperations.IsCloneApplySuccessful(tokenId); } else if (operation == "getIsReadyToBreed") { if (args.Length != 1) { result.Value = 0; return(result); } BigInteger tokenId = (BigInteger)args[0]; result.Value = GameOperations.IsReadyToBreed(tokenId); } else if (operation == "giveBirth") { if (args.Length != 1) { result.Value = 0; return(result); } BigInteger motherId = (BigInteger)args[0]; result.Value = GameOperations.GiveBirth(motherId); } else if (operation == "bidOnClone_app") { if (args.Length != 3) { result.Value = 0; return(result); } byte[] owner = (byte[])args[0]; BigInteger motherId = (BigInteger)args[1]; BigInteger fatherId = (BigInteger)args[2]; byte[] marketAddress = DataAccess.GetMarketAddressAsBytes(); if (callingScript.AsBigInteger() != marketAddress.AsBigInteger()) { result.Value = false; return(result); } result.Value = GameOperations.BreedWithId_app(owner, motherId, fatherId); } else if (operation == "breedWithMy_app") { if (args.Length != 3) { result.Value = 0; return(result); } byte[] owner = (byte[])args[0]; BigInteger motherId = (BigInteger)args[1]; BigInteger fatherId = (BigInteger)args[2]; byte[] marketAddress = DataAccess.GetMarketAddressAsBytes(); if (callingScript.AsBigInteger() != marketAddress.AsBigInteger()) { result.Value = false; return(result); } object[] rawFatherToken = DataAccess.GetTokenAsObjects(fatherId.AsByteArray()); if (rawFatherToken.Length > 0) { TokenInfo fatherInfo = (TokenInfo)(object)rawFatherToken; if (fatherInfo.Owner.AsBigInteger() == owner.AsBigInteger()) { result.Value = GameOperations.BreedWithId_app(owner, motherId, fatherId); return(result); } } result.Value = false; } else if (operation == "createGenerationZeroFromAuction_app") { byte[] tokenOwner = (byte[])args[0]; byte strength = (byte)args[1]; byte power = (byte)args[2]; byte agile = (byte)args[3]; byte speed = (byte)args[4]; BigInteger generation = (int)args[5]; byte[] marketAddress = DataAccess.GetMarketAddressAsBytes(); if (callingScript.AsBigInteger() != marketAddress.AsBigInteger()) { result.Value = false; return(result); } result.Value = NepOperations.CreateToken(tokenOwner, strength, power, agile, speed, generation); } else { result.IsComplete = false; } return(result); }
/// <summary> /// Release Promotion Gladiator /// </summary> private static BigInteger MintToken( byte[] tokenOwner, byte strength, byte power, byte agile, byte speed, BigInteger generation) => NepOperations.CreateToken(tokenOwner, strength, power, agile, speed, generation);
/// <summary> /// Release Promotion Gladiator /// </summary> private static BigInteger MintToken( byte[] owner, byte health, byte mana, byte agility, byte stamina, byte criticalStrike, byte attackSpeed, byte versatility, byte mastery, BigInteger level) => NepOperations.CreateToken(owner, health, mana, agility, stamina, criticalStrike, attackSpeed, versatility, mastery, level);