public void SetDatas(int offerId, string transactionId, LogicDeliverableBundle deliverableBundle, LogicBillingPackageData billingPackageData) { this.m_offerId = offerId; this.m_transactionId = transactionId; this.m_deliverableBundle = deliverableBundle; this.m_billingPackageData = billingPackageData; }
public override void Decode(ByteStream stream) { base.Decode(stream); this.m_offerId = stream.ReadVInt(); this.m_transactionId = stream.ReadString(900000); if (this.m_deliverableBundle != null) { this.m_deliverableBundle.Destruct(); this.m_deliverableBundle = null; } this.m_deliverableBundle = new LogicDeliverableBundle(); this.m_deliverableBundle.Decode(stream); this.m_billingPackageData = (LogicBillingPackageData)ByteStreamHelper.ReadDataReference(stream, LogicDataType.BILLING_PACKAGE); }
/// <summary> /// Executes this command. /// </summary> public override int Execute(LogicLevel level) { LogicClientAvatar playerAvatar = level.GetPlayerAvatar(); if (playerAvatar != null) { if (this._source == 1) { // listener. } playerAvatar.SetDiamonds(playerAvatar.GetDiamonds() + this._diamondsCount); if (this._freeDiamonds) { int freeDiamonds = playerAvatar.GetFreeDiamonds(); if (this._diamondsCount < 0) { if (freeDiamonds - this._diamondsCount >= 0 && playerAvatar.GetDiamonds() != freeDiamonds) { playerAvatar.SetFreeDiamonds(freeDiamonds + this._diamondsCount); } } else { playerAvatar.SetFreeDiamonds(freeDiamonds + this._diamondsCount); } } else { if (this._billingPackageId > 0) { LogicBillingPackageData billingPackageData = (LogicBillingPackageData)LogicDataTables.GetDataById(this._billingPackageId, 21); if (billingPackageData != null) { if (billingPackageData.RED && !this._bundlePackage) { int redPackageState = playerAvatar.GetRedPackageState(); int newRedPackageState = redPackageState | 0x10; if ((redPackageState & 3) != 3) { newRedPackageState = (int)(newRedPackageState & 0xFFFFFFFC); } playerAvatar.SetRedPackageState(newRedPackageState); } } } level.GetGameListener().DiamondsBought(); playerAvatar.AddCumulativePurchasedDiamonds(this._diamondsCount); } return(0); } return(-1); }