update logic embed stone
This commit is contained in:
@@ -76,6 +76,8 @@ namespace PerfectWorld.Scripts.Managers
|
||||
protected ARMOR_MAJOR_TYPE m_pDBMajorType;
|
||||
protected ARMOR_SUB_TYPE m_pDBSubType;
|
||||
protected ARMOR_ESSENCE m_pDBEssence;
|
||||
|
||||
public ARMOR_ESSENCE GetDBEssence() { return m_pDBEssence; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for armor item (Mu + Ao + Quan + Giay) / Constructor for armor item (Helmet + Armor + Pants + Boots)
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace PerfectWorld.Scripts.Managers
|
||||
protected DECORATION_MAJOR_TYPE m_pDBMajorType;
|
||||
protected DECORATION_SUB_TYPE m_pDBSubType;
|
||||
protected DECORATION_ESSENCE m_pDBEssence;
|
||||
|
||||
public DECORATION_ESSENCE GetDBEssence() { return m_pDBEssence; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for decoration item (cac loai trang suc) / Constructor for decoration item (various types of decorations)
|
||||
|
||||
@@ -705,6 +705,9 @@ namespace BrewMonster.Scripts.Managers
|
||||
public bool m_bLocalDetailData; // true, data from GetDetailDataFromLocal
|
||||
|
||||
public EC_Inventory m_pDescIvtr; // Inventory only used to get item description
|
||||
|
||||
private ushort m_dwData;
|
||||
private string m_strDataName;
|
||||
|
||||
#region Constructors
|
||||
|
||||
@@ -2114,6 +2117,17 @@ namespace BrewMonster.Scripts.Managers
|
||||
}
|
||||
|
||||
#endregion
|
||||
// public ushort GetData(string strName = "")
|
||||
// {
|
||||
// // if (0 != m_dwData && strName != m_strDataName)
|
||||
// // AUI_ReportError(__LINE__, 1, "AUIObject::GetData(), data name not match");
|
||||
// return m_dwData;
|
||||
// }
|
||||
// public void SetData(ushort dwData, string strName)
|
||||
// {
|
||||
// m_strDataName = strName;
|
||||
// m_dwData = dwData;
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -76,6 +76,7 @@ namespace PerfectWorld.Scripts.Managers
|
||||
protected WEAPON_MAJOR_TYPE m_pDBMajorType;
|
||||
protected WEAPON_SUB_TYPE m_pDBSubType;
|
||||
protected WEAPON_ESSENCE m_pDBEssence;
|
||||
public WEAPON_ESSENCE GetDBEssence() { return m_pDBEssence; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for weapon item (cac loai vu khi)
|
||||
|
||||
@@ -9,6 +9,7 @@ using PerfectWorld.Scripts.Task;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using BrewMonster.Scripts;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -38,6 +39,7 @@ namespace BrewMonster
|
||||
|
||||
private int m_FirstInvSlot = -1;
|
||||
private int m_SecondInvSlot = -1;
|
||||
private int m_install_price = -1;
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
@@ -51,7 +53,10 @@ namespace BrewMonster
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
//todo need to set from other class
|
||||
// SetName("Win_Enchase");
|
||||
m_BtnMerge.onClick.AddListener(OnClickedMerge);
|
||||
m_install_price = -1;
|
||||
}
|
||||
|
||||
public override void OnDisable()
|
||||
@@ -371,100 +376,112 @@ namespace BrewMonster
|
||||
private void OnClickedMerge()
|
||||
{
|
||||
// PAUIDIALOG pMsgBox;
|
||||
// CECHostPlayer pHost = GetHostPlayer();
|
||||
//
|
||||
// // if( !m_pItema->GetDataPtr("ptr_CECIvtrItem") ) return;
|
||||
//
|
||||
// int nMoney = a_atoi(m_pTxtGold->GetText());
|
||||
// if( nMoney > pHost.GetMoneyAmount() )
|
||||
// {
|
||||
// Debug.LogError(GetGameUIMan().GetStringFromTable(226));
|
||||
// // GetGameUIMan()->MessageBox("", GetGameUIMan().GetStringFromTable(226), MB_OK,
|
||||
// // A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// // pMsgBox->SetLife(3);
|
||||
// return;
|
||||
// }
|
||||
CECHostPlayer pHost = GetHostPlayer();
|
||||
|
||||
// if( !m_pItema->GetDataPtr("ptr_CECIvtrItem") ) return;
|
||||
string message = "";
|
||||
|
||||
int nMoney = m_install_price;
|
||||
if( nMoney > pHost.GetMoneyAmount() )
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(226);
|
||||
Debug.LogError(message);
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan().GetStringFromTable(226), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox->SetLife(3);
|
||||
return;
|
||||
}
|
||||
|
||||
// CECIvtrItem *pIvtrA = (CECIvtrItem *)m_pItema->GetDataPtr("ptr_CECIvtrItem");
|
||||
// if( !pIvtrA->IsEquipment() )
|
||||
// {
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(223), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox->SetLife(3);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// CECIvtrEquip *pEquipA = (CECIvtrEquip *)pIvtrA;
|
||||
EC_IvtrItem pIvtrA = m_SelectedEquip;
|
||||
if( !pIvtrA.IsEquipment() )
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(223);
|
||||
Debug.LogError(message);
|
||||
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(223), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox.SetLife(3);
|
||||
return;
|
||||
}
|
||||
|
||||
EC_IvtrEquip pEquipA = (EC_IvtrEquip)pIvtrA;
|
||||
// a_LogOutput(1, "[Dat Embed] Send protocol here");
|
||||
// if( 0 == stricmp(GetName(), "Win_Enchase") )
|
||||
// if( 0 == string.CompareOrdinal(GetName(), "Win_Enchase") )
|
||||
// {
|
||||
// if( pEquipA->GetEmptyHoleNum() <= 0 )
|
||||
// {
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(224), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox->SetLife(3);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// CECIvtrItem *pIvtrB = (CECIvtrItem *)m_pItemb->GetDataPtr("ptr_CECIvtrItem");
|
||||
// if( !pIvtrB || !pIvtrB->IsEmbeddable() )
|
||||
// {
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(225), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox->SetLife(3);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if( pIvtrB->GetClassID() != CECIvtrItem::ICID_STONE)
|
||||
// return;
|
||||
//
|
||||
// int nStoneLevel = ((CECIvtrStone*)pIvtrB)->GetDBEssence()->level;
|
||||
// int nEquipLevel = -1;
|
||||
// switch( pEquipA->GetClassID() )
|
||||
// {
|
||||
// case CECIvtrItem::ICID_WEAPON:
|
||||
// nEquipLevel = ((CECIvtrWeapon*)pEquipA)->GetDBEssence()->level;
|
||||
// break;
|
||||
// case CECIvtrItem::ICID_ARMOR:
|
||||
// nEquipLevel = ((CECIvtrArmor*)pEquipA)->GetDBEssence()->level;
|
||||
// break;
|
||||
// case CECIvtrItem::ICID_DECORATION:
|
||||
// nEquipLevel = ((CECIvtrDecoration*)pEquipA)->GetDBEssence()->level;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if( nStoneLevel > nEquipLevel )
|
||||
// {
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(300), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox->SetLife(3);
|
||||
// return;
|
||||
// }
|
||||
// //pr
|
||||
// GetGameSession()->c2s_CmdNPCSevEmbed(
|
||||
// (WORD)m_pItemb->GetData(), (WORD)m_pItema->GetData(),
|
||||
// pIvtrB->GetTemplateID(), pIvtrA->GetTemplateID());
|
||||
// ClearEquipment();
|
||||
// ClearStone();
|
||||
// pHost->GetPack(IVTRTYPE_PACK)->UnfreezeAllItems();
|
||||
//
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(228),
|
||||
// MB_OK, A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox->SetLife(3);
|
||||
if( pEquipA.GetEmptyHoleNum() <= 0 )
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(224);
|
||||
Debug.LogError(message);
|
||||
// GetGameUIMan().MessageBox("", GetGameUIMan()->GetStringFromTable(224), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox.SetLife(3);
|
||||
return;
|
||||
}
|
||||
|
||||
EC_IvtrItem pIvtrB = m_SelectedMaterial;
|
||||
if(pIvtrB == null || !pIvtrB.IsEmbeddable() )
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(225);
|
||||
Debug.LogError(message);
|
||||
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(225), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox.SetLife(3);
|
||||
return;
|
||||
}
|
||||
|
||||
if( pIvtrB.GetClassID() != (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_STONE)
|
||||
return;
|
||||
|
||||
int nStoneLevel = ((EC_IvtrStone)pIvtrB).GetDBEssence().level;
|
||||
int nEquipLevel = -1;
|
||||
switch( pEquipA.GetClassID() )
|
||||
{
|
||||
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_WEAPON:
|
||||
nEquipLevel = ((EC_IvtrWeapon)pEquipA).GetDBEssence().level;
|
||||
break;
|
||||
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_ARMOR:
|
||||
nEquipLevel = ((EC_IvtrArmor)pEquipA).GetDBEssence().level;
|
||||
break;
|
||||
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_DECORATION:
|
||||
nEquipLevel = ((EC_IvtrDecoration)pEquipA).GetDBEssence().level;
|
||||
break;
|
||||
}
|
||||
|
||||
if( nStoneLevel > nEquipLevel )
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(300);
|
||||
Debug.LogError(message);
|
||||
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(300), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox.SetLife(3);
|
||||
return;
|
||||
}
|
||||
//pr
|
||||
UnityGameSession.c2s_CmdNPCSevEmbed(
|
||||
(ushort)m_SecondInvSlot, (ushort)m_FirstInvSlot,
|
||||
pIvtrB.GetTemplateID(), pIvtrA.GetTemplateID());
|
||||
// ClearEquipment();
|
||||
// ClearStone();
|
||||
pHost.GetPack(InventoryConst.IVTRTYPE_PACK).UnfreezeAllItems();
|
||||
|
||||
message = GetGameUIMan().GetStringFromTable(228);
|
||||
Debug.LogError(message);
|
||||
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(228),
|
||||
// MB_OK, A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox.SetLife(3);
|
||||
// }
|
||||
// else if( 0 == stricmp(GetName(), "Win_Disenchase") )
|
||||
// {
|
||||
// a_LogOutput(1, "[Dat Embed] Win_Disenchase");
|
||||
// if( pEquipA->GetEmptyHoleNum() == pEquipA->GetHoleNum() )
|
||||
// {
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(227), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox->SetLife(3);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// GetGameUIMan()->MessageBox("Game_Disenchase", GetGameUIMan()->GetStringFromTable(229),
|
||||
// MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160));
|
||||
// a_LogOutput(1, "[Dat Embed] Win_Disenchase");
|
||||
// if( pEquipA->GetEmptyHoleNum() == pEquipA->GetHoleNum() )
|
||||
// {
|
||||
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(227), MB_OK,
|
||||
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
// pMsgBox->SetLife(3);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// GetGameUIMan()->MessageBox("Game_Disenchase", GetGameUIMan()->GetStringFromTable(229),
|
||||
// MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user