public void Recv_Owner_ItemBuy(body_SC_PRIVATESHOP_OWNER_ITEMBUY _buy) { if(AsHudDlgMgr.Instance.IsOpenPStore == true) AsHudDlgMgr.Instance.pstoreDlg.ItemSold(_buy); if(AsHudDlgMgr.Instance.IsOpenInven == true) AsHudDlgMgr.Instance.invenDlg.ItemSoldByPStore(_buy); foreach(KeyValuePair<int, body2_SC_PRIVATESHOP_OWNER_ITEMLIST> pair in m_dicPlayerShopItem) { if(pair.Value.nPrivateShopSlot == _buy.nPrivateShopSlot) { InvenSlot invenSlot = ItemMgr.HadItemManagement.Inven.GetInvenSlotItem( pair.Value.nInvenSlot ); if( null != invenSlot) { // string name = AsTableManager.Instance.GetTbl_String(invenSlot.realItem.item.ItemData.nameId); // string str = string.Format(AsTableManager.Instance.GetTbl_String(200), name, _buy.nItemCount, (int)_buy.nItemCount * (int)item.nItemGold ); // AsChatManager.Instance.InsertChat(str,eCHATTYPE.eCHATTYPE_SYSTEM); string name = AsTableManager.Instance.GetTbl_String(invenSlot.realItem.item.ItemData.nameId); double earn = (double)_buy.nItemCount * (double)pair.Value.nItemGold; // int commission = (int)(earn * AsTableManager.Instance.GetTbl_GlobalWeight_Record(14).Value * 0.01f + 0.5f); // string header = AsTableManager.Instance.GetTbl_String(126); // string body = string.Format(AsTableManager.Instance.GetTbl_String(214), name, _buy.nItemCount, earn - commission, commission); // AsNotify.Instance.MessageBox(header, body); double commission = (earn * AsTableManager.Instance.GetTbl_GlobalWeight_Record(14).Value * 0.01d + 0.5d); // int nCurrentChannel = AsUserInfo.Instance.currentChannel; // body2_GC_CHANNEL_LIST channel = AsChannelListData.Instance.GetDataByChannelIndex( nCurrentChannel); // // if( null != channel) // { // if( true == channel.bIsPrivateShop) // commission = (earn * (channel.nPrivateStore_Charge - channel.nPrivateStore_ChargeReduction) * 0.01d + 0.5d); // else // commission = (earn * channel.nPrivateStore_Charge * 0.01d + 0.5d); // } // else // Debug.LogError("AsPStoreManager::Recv_Owner_ItemBuy: current channel is not found. nCurrentChannel = " + nCurrentChannel); commission = (earn * _buy.nPrivateStore_Charge * 0.01d + 0.5d); string header = AsTableManager.Instance.GetTbl_String(126); string body = string.Format(AsTableManager.Instance.GetTbl_String(214), name, _buy.nItemCount, (ulong)earn - (ulong)commission, (ulong)commission); AsNotify.Instance.MessageBox(header, body); } pair.Value.sItem.nOverlapped -= _buy.nItemCount; if(pair.Value.sItem.nOverlapped < 1) { // AsHudDlgMgr.Instance.invenDlg.SetSlotMoveLock(pair.Value.nInvenSlot, false); ItemMgr.HadItemManagement.Inven.SetSlotMoveLock(pair.Value.nInvenSlot, false); if(AsHudDlgMgr.Instance.IsOpenInven == true) AsHudDlgMgr.Instance.invenDlg.ApplySlotMoveLock(); m_dicPlayerShopItem.Remove(pair.Key); } break; } } Debug.Log("AsPStoreManager::Recv_Owner_ItemBuy: m_dicPlayerShopItem.Count == " + m_dicPlayerShopItem.Count); if(m_dicPlayerShopItem.Count == 0) { Debug.Log("AsPStoreManager::Recv_Owner_ItemBuy: m_dicPlayerShopItem.Count == 0"); string str = AsTableManager.Instance.GetTbl_String(201); AsChatManager.Instance.InsertChat(str, eCHATTYPE.eCHATTYPE_SYSTEM); m_StoreState = ePStoreState.Closed; AsHudDlgMgr.Instance.ClosePStore(); } Debug.Log("AsPStoreManager::Recv_Owner_ItemBuy: " + _buy.eResult); }
public void ItemUsed(RealItem _item) { if(_item == null) { Debug.LogError("AsPStoreManager::ItemUsed: _item = null"); return; } //dopamin if(AsPartyManager.Instance.IsPartyNotice) { AsEventNotifyMgr.Instance.CenterNotify.AddGMMessage(AsTableManager.Instance.GetTbl_String(1728)); return; } //product if(AsUserInfo.Instance.isProductionProgress == true) { AsHudDlgMgr.Instance.SetMsgBox( AsNotify.Instance.MessageBox( AsTableManager.Instance.GetTbl_String(126), AsTableManager.Instance.GetTbl_String(379), null, "", AsNotify.MSG_BOX_TYPE.MBT_OK, AsNotify.MSG_BOX_ICON.MBI_NOTICE)); return; } if( true == AsPvpManager.Instance.CheckMatching() || true == AsPvpManager.Instance.CheckInArena()) return; if( true == AsInstanceDungeonManager.Instance.CheckMatching() || true == AsInstanceDungeonManager.Instance.CheckInIndun()) return; Map map = TerrainMgr.Instance.GetCurrentMap(); eMAP_TYPE mapType = map.MapData.getMapType; switch(mapType) { case eMAP_TYPE.Field: case eMAP_TYPE.Tutorial: case eMAP_TYPE.Indun: case eMAP_TYPE.Pvp: case eMAP_TYPE.Raid: case eMAP_TYPE.Summon: // string header = AsTableManager.Instance.GetTbl_String(126); string str = AsTableManager.Instance.GetTbl_String(294); AsEventNotifyMgr.Instance.CenterNotify.AddQuestMessage(str, false); // AsNotify.Instance.MessageBox(header, str); // AsChatManager.Instance.InsertChat(str, eCHATTYPE.eCHATTYPE_SYSTEM); // Debug.LogWarning("ItemUsed: shop can not be opened out of town."); return; case eMAP_TYPE.Town: break; } // AsChatManager.Instance.InsertChat("Private shop is under construction.", eCHATTYPE.eCHATTYPE_SYSTEM, true); if(AsCommonSender.isSendWarp == true) { Debug.Log("AsPStoreManager::ItemUsed: AsCommonSender.isSendWarp == true. ignore private shop."); return; } if(CheckPStoreOpenItem(_item.sItem.nItemTableIdx) == false) { Debug.LogWarning("AsPStoreManager::ItemUsed: CheckPStoreOpenItem(_item.sItem.nItemTableIdx) == false. ignore private shop."); return; } // AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage(new Msg_MoveStopIndication()); AsUserEntity user = AsUserInfo.Instance.GetCurrentUserEntity(); if(user.GetProperty<bool>(eComponentProperty.SHOP_OPENING) == false) { AsNpcEntity npc = null; float minNpc = AsEntityManager.Instance.GetNearestNpcForPStore(user.transform.position, out npc); s_ShopOpenPossibleDistance = AsTableManager.Instance.GetTbl_GlobalWeight_Record(18).Value; if(minNpc < s_ShopOpenPossibleDistance) { // Debug.Log("AsPStoreManager::ItemUsed: npc is too close. find proper place."); // string header = AsTableManager.Instance.GetTbl_String(126); string str = AsTableManager.Instance.GetTbl_String(286); AsEventNotifyMgr.Instance.CenterNotify.AddQuestMessage(str, false); // AsNotify.Instance.MessageBox(header, str); // AsChatManager.Instance.InsertChat(str, eCHATTYPE.eCHATTYPE_SYSTEM); return; } AsUserEntity shop = null; float minShop = AsEntityManager.Instance.GetNearestPrivateShop(user.transform.position, out shop); float possibleDistance_Pc = AsTableManager.Instance.GetTbl_GlobalWeight_Record(17).Value; if(minShop < possibleDistance_Pc) { // Debug.Log("AsPStoreManager::ItemUsed: private shop is too close. find proper place."); // string header = AsTableManager.Instance.GetTbl_String(126); string str = AsTableManager.Instance.GetTbl_String(377); AsEventNotifyMgr.Instance.CenterNotify.AddQuestMessage(str, false); // AsNotify.Instance.MessageBox(header, str); // AsChatManager.Instance.InsertChat(str, eCHATTYPE.eCHATTYPE_SYSTEM); return; } float minPortal = AsPortalTrigger.ClosestPortalDistance(); float possibleDistance_Portal = AsTableManager.Instance.GetTbl_GlobalWeight_Record(68).Value; if(minPortal < possibleDistance_Portal) { // Debug.Log("AsPStoreManager::ItemUsed: portal is too close. find proper place."); // string header = AsTableManager.Instance.GetTbl_String(126); string str = AsTableManager.Instance.GetTbl_String(378); AsEventNotifyMgr.Instance.CenterNotify.AddQuestMessage(str, false); // AsNotify.Instance.MessageBox(header, str); // AsChatManager.Instance.InsertChat(str, eCHATTYPE.eCHATTYPE_SYSTEM); return; } m_PStoreItemUsedSlot = _item; _item.SendUseItem(); } else { m_PStoreItemUsedSlot = ItemMgr.HadItemManagement.Inven.GetRealItemInSlot( AsUserInfo.Instance.nPrivateShopCreateItemSlot); if(m_PStoreItemUsedSlot != null && m_PStoreItemUsedSlot.sItem.nItemTableIdx == _item.sItem.nItemTableIdx) { m_StoreState = ePStoreState.User_Opening; Debug.LogWarning("Bug Searching::: AsPStoreManager:: ItemUsed: private shop dialog is instantiated"); AsHudDlgMgr.Instance.OpenPStore(); } } }
public void Recv_ItemList(body1_SC_PRIVATESHOP_ITEMLIST _list) { m_StoreState = ePStoreState.Another_Opened; Debug.LogWarning("Bug Searching::: AsPStoreManager:: Recv_ItemList: private shop dialog is instantiated"); if( m_SearchDlg == null) { AsHudDlgMgr.Instance.OpenPStore(); AsHudDlgMgr.Instance.pstoreDlg.SetOtherPStoreItem(_list); } }
public void Recv_Owner_ItemList(body1_SC_PRIVATESHOP_OWNER_ITEMLIST _list) { m_StoreState = ePStoreState.User_Opening; //must be added // m_PStoreItemUsedSlot = _list. m_dicPlayerShopItem.Clear(); foreach(body2_SC_PRIVATESHOP_OWNER_ITEMLIST item in _list.body) { m_dicPlayerShopItem.Add(item.nPrivateShopSlot, item); ItemMgr.HadItemManagement.Inven.SetSlotMoveLock(item.nInvenSlot, true); } Debug.Log("AsPStoreManager::Recv_Owner_ItemList: state = " + m_StoreState); bool shop = AsUserInfo.Instance.GetCurrentUserEntity().GetProperty<bool>(eComponentProperty.SHOP_OPENING); if(shop == false) Debug.LogError("AsPStoreManager::Recv_Owner_ItemList: shop opening data is not set, but Owner_ItemList is send. check server routine."); if( AsHudDlgMgr.Instance.IsOpenInven ) AsHudDlgMgr.Instance.invenDlg.ApplySlotMoveLock(); // if(AsHudDlgMgr.Instance.IsOpenPStore == true) // { // LockRegisteredShopItem(); // } }
public void Recv_Close(body_SC_PRIVATESHOP_CLOSE _close) { Debug.Log("AsPStoreManager::Recv_Close: " + _close.eResult); Debug.Log("Recv_Close: m_CurShopUId = " + m_CurShopUId + ", _close.nPrivateShopUID = " + _close.nPrivateShopUID); if(_close.eResult == eRESULTCODE.eRESULT_SUCC) { AsUserEntity entity = AsEntityManager.Instance.GetUserEntityByUniqueId(_close.nCharUniqKey); if(entity == null) { Debug.LogError("Recv_Close: _close.nCharUniqKey = " + _close.nCharUniqKey); return; } // Debug.Log("Recv_Close: m_CurShopUId = " + m_CurShopUId + ", _close.nPrivateShopUID = " + _close.nPrivateShopUID); // Debug.Log("Recv_Close: _close.bIsDelete = " + _close.bIsDelete); if(entity.FsmType == eFsmType.PLAYER) { AsUserInfo.Instance.ClosePrivateShop(); m_StoreState = ePStoreState.User_Standby; if(AsHudDlgMgr.Instance.IsOpenPStore == true) { AsHudDlgMgr.Instance.pstoreDlg.SetBtnByState(); AsHudDlgMgr.Instance.pstoreDlg.StopTimeProcess(); AsHudDlgMgr.Instance.pstoreDlg.SetDefaultTimeProcess(); } AsUserEntity player = AsUserInfo.Instance.GetCurrentUserEntity(); player.HandleMessage(new Msg_ClosePrivateShop()); } else if(AsHudDlgMgr.Instance.IsOpenPStore == true && _close.nPrivateShopUID == m_CurShopUId) { AsHudDlgMgr.Instance.ClosePStore(); m_CurShopUId = uint.MaxValue; } if(entity.FsmType != eFsmType.PLAYER) AsEntityManager.Instance.RemoveEntity(entity); } }
public void Recv_Leave(body_SC_PRIVATESHOP_LEAVE _leave) { Debug.Log("AsPStoreManager::Recv_Leave: "); // if(_leave.eResult == eRESULTCODE.eRESULT_SUCC) // { // m_CurShopUId = uint.MaxValue; // } m_StoreState = ePStoreState.Closed; }
public void Recv_Destroy(body_SC_PRIVATESHOP_DESTROY _destroy) { Debug.Log("AsPStoreManager::Recv_Destroy: AsGameMain.isBackGroundPause = " + AsGameMain.isBackGroundPause); Debug.Log("AsPStoreManager::Recv_Destroy: AsGameMain.s_gameState = " + AsGameMain.s_gameState); m_StoreState = ePStoreState.Closed; switch(AsGameMain.s_gameState) { case GAME_STATE.STATE_CHARACTER_SELECT: AsCharacterSlotManager.ShopDestroyed(); AsUserInfo.Instance.ClosePrivateShop(); break; case GAME_STATE.STATE_LOADING: // case GAME_STATE.STATE_LOAD_END: case GAME_STATE.STATE_INGAME: ClearRegisteredShopItem(); AsUserInfo.Instance.ClosePrivateShop(); AsUserEntity player = AsUserInfo.Instance.GetCurrentUserEntity(); Debug.Log("AsPStoreManager::Recv_Destroy: AsUserInfo.Instance.GetCurrentUserEntity() = " + player); if(player != null) { player.HandleMessage(new Msg_ClosePrivateShop()); Debug.Log("AsPStoreManager::Recv_Destroy: player.GetProperty<bool>(eComponentProperty.SHOP_OPENING) = " + player.GetProperty<bool>(eComponentProperty.SHOP_OPENING)); } Debug.Log("AsPStoreManager::Recv_Destroy: AsHudDlgMgr.Instance.IsOpenPStore = " + AsHudDlgMgr.Instance.IsOpenPStore); if(AsHudDlgMgr.Instance.IsOpenPStore == true) AsHudDlgMgr.Instance.ClosePStore(); break; } foreach(KeyValuePair<int, body2_SC_PRIVATESHOP_OWNER_ITEMLIST> pair in m_dicPlayerShopItem) { ItemMgr.HadItemManagement.Inven.SetSlotMoveLock(pair.Value.nInvenSlot, false); } m_dicPlayerShopItem.Clear(); Debug.Log("AsPStoreManager::Recv_Destroy: " + _destroy.eResult + "(GAME_STATE = " + AsGameMain.s_gameState + ")"); }
public void Recv_Open(body_SC_PRIVATESHOP_OPEN _open) { Debug.Log("AsPStoreManager::Recv_Open: " + _open.eResult); if(_open.eResult == eRESULTCODE.eRESULT_SUCC) { AsUserEntity entity = AsEntityManager.Instance.GetUserEntityByUniqueId(_open.nCharUniqKey); if(entity == null) { entity = AsEntityManager.Instance.CreateUserEntity("OtherUser", new OtherCharacterAppearData(_open)); // entity.SetRePosition(_open.sCurPosition); // Debug.LogError("Recv_Open: _open.nCharUniqKey = " + _open.nCharUniqKey); } if(entity.FsmType == eFsmType.PLAYER) { // cool time StartCoroutine(OpenCoolProcess()); string notify = AsTableManager.Instance.GetTbl_String(417); AsEventNotifyMgr.Instance.CenterNotify.AddGMMessage(notify); m_CurShopUId = _open.nPrivateShopUID; m_StoreState = ePStoreState.User_Opening; AsUserInfo.Instance.SetPrivateShopInfo(_open); m_RemainTime = (float)_open.nPrivateShopRemainingTime; m_PStoreItemUsedSlot = ItemMgr.HadItemManagement.Inven.GetRealItemInSlot(_open.nOpenItemInvenSlot); if(m_PStoreItemUsedSlot == null) Debug.LogWarning("AsPStoreManager::Recv_Open: _open.nOpenItemInvenSlot = " + _open.nOpenItemInvenSlot + ". check whether open item was expired."); SetContent(_open.strContent); entity.SetShopData(_open); AsHudDlgMgr.Instance.pstoreDlg.BeginTimeProcess(); if(AsHudDlgMgr.Instance.IsOpenPStore == true) { AsHudDlgMgr.Instance.pstoreDlg.SetBtnByState(); AsHudDlgMgr.Instance.pstoreDlg.BeginTimeProcess(); } AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage(new Msg_OpenPrivateShop(_open.nOpenItemTableIdx)); // m_OpenInfo = _open; } else { entity.SetShopData(_open); entity.HandleMessage(new Msg_OpenPrivateShop(_open.nOpenItemTableIdx)); } entity.SetRePosition(_open.sCurPosition); Debug.Log("AsPStoreManager::Recv_Open: _open.nCharUniqKey = " + _open.nCharUniqKey); Debug.Log("AsPStoreManager::Recv_Open: _open.sCurPosition = " + _open.sCurPosition); } }
public void Recv_Create(body_SC_PRIVATESHOP_CREATE _create) { if(_create.eResult == eRESULTCODE.eRESULT_SUCC) { m_dicPlayerShopItem.Clear(); m_StoreState = ePStoreState.User_Standby; Debug.LogWarning("Bug Searching::: AsPStoreManager:: Recv_Create: private shop dialog is instantiated"); AsHudDlgMgr.Instance.OpenPStore(); } // AsUserInfo.Instance.GetCurrentUserEntity().HandleMessage(new Msg_MoveStopIndication()); }
// public void PStoreDlgOpened(UIPStoreDlg _pstoreDlg) // { //// m_PStoreDlg = _pstoreDlg; // } public void Close() { Debug.LogWarning("AsPStoreManager::Close: store state = " + m_StoreState); // m_PStoreDlg = null; switch(m_StoreState) { case ePStoreState.User_Standby: Request_Destroy(); m_StoreState = ePStoreState.Closed; break; case ePStoreState.User_Opening: m_StoreState = ePStoreState.User_Folded; break; case ePStoreState.Another_Opened: Request_Leave(); m_StoreState = ePStoreState.Closed; break; } }
public void ReadyPStore() { AsUserEntity user = AsUserInfo.Instance.GetCurrentUserEntity(); if(user.GetProperty<bool>(eComponentProperty.SHOP_OPENING) == false) { body_CG_CHEAT cheat = new body_CG_CHEAT(26, "", 1, 0, 0, 0, 0, 0); AsCommonSender.Send(cheat.ClassToPacketBytes()); } else { m_StoreState = ePStoreState.User_Opening; Debug.LogWarning("Bug Searching::: AsPStoreManager:: ReadyPStore: private shop dialog is instantiated"); AsHudDlgMgr.Instance.OpenPStore(); } }
public void OpenFoldedUserPrivateShop() { m_StoreState = ePStoreState.User_Opening; AsHudDlgMgr.Instance.OpenPStore(); }
public void GameReset() { m_StoreState = ePStoreState.Closed; m_PStoreEnableSlot = ePStoreEnableSlot.NONE; m_PStoreItemUsedSlot = null; m_strTitle = ""; m_strContent = ""; m_dicPlayerShopItem.Clear(); m_CurShopUId = 0; m_RemainTime = 0; }