diff --git a/src/xrGame/Actor.cpp b/src/xrGame/Actor.cpp index c14d93c1a5..1253432040 100644 --- a/src/xrGame/Actor.cpp +++ b/src/xrGame/Actor.cpp @@ -1545,8 +1545,7 @@ void CActor::shedule_Update (u32 DT) } else { - if (m_pPersonWeLookingAt && pEntityAlive->g_Alive() && m_pPersonWeLookingAt->IsTalkEnabled()) - { + if (m_pPersonWeLookingAt && pEntityAlive->g_Alive() && m_pPersonWeLookingAt->IsTalkEnabled() && !pEntityAlive->cast_actor()) { m_sDefaultObjAction = m_sCharacterUseAction; } else if ( pEntityAlive && !pEntityAlive->g_Alive() ) diff --git a/src/xrGame/FreeMP/game_cl_freemp.cpp b/src/xrGame/FreeMP/game_cl_freemp.cpp index 6729144998..508178d27b 100644 --- a/src/xrGame/FreeMP/game_cl_freemp.cpp +++ b/src/xrGame/FreeMP/game_cl_freemp.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +п»ї#include "stdafx.h" #include "game_cl_freemp.h" #include "clsid_game.h" #include "../../xrEngine/xr_level_controller.h" @@ -62,6 +62,36 @@ void game_cl_freemp::net_import_update(NET_Packet& P) inherited::net_import_update(P); } +void game_cl_freemp::shedule_Update(u32 dt) +{ + if (!local_player) + return; + + for (auto cl : players) + { + game_PlayerState* ps = cl.second; + if (!ps || ps->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD)) continue; + + CActor* pActor = smart_cast(Level().Objects.net_Find(ps->GameID)); + if (!pActor || !pActor->g_Alive()) continue; + + pActor->SetName(ps->getName()); + pActor->cName_set(ps->getName()); + + if (ps->team != pActor->Community()) + { + CHARACTER_COMMUNITY community; + community.set(ps->team); + pActor->SetCommunity(community.index()); + pActor->ChangeTeam(community.team(), 0, 0); + } + + if (local_player->GameID == ps->GameID) + { + pActor->set_money((u32)ps->money_for_round, false); + } + } +} bool game_cl_freemp::OnKeyboardPress(int key) { if (kJUMP == key) @@ -116,6 +146,11 @@ BOOL game_sv_freemp::OnTouch(u16 eid_who, u16 eid_what, BOOL bForced) if (!e_entity) return FALSE; + if (e_entity->m_tClassID == CLSID_OBJECT_PLAYERS_BAG) + { + return OnTouchPlayersBag(e_who, e_entity); + } + return TRUE; } diff --git a/src/xrGame/FreeMP/game_cl_freemp.h b/src/xrGame/FreeMP/game_cl_freemp.h index fa18171562..6de1e48a53 100644 --- a/src/xrGame/FreeMP/game_cl_freemp.h +++ b/src/xrGame/FreeMP/game_cl_freemp.h @@ -20,6 +20,8 @@ class game_cl_freemp :public game_cl_mp virtual void net_import_state(NET_Packet& P); virtual void net_import_update(NET_Packet& P); + virtual void shedule_Update(u32 dt); + virtual bool OnKeyboardPress(int key); virtual void OnConnected(); diff --git a/src/xrGame/FreeMP/game_sv_freemp.cpp b/src/xrGame/FreeMP/game_sv_freemp.cpp index b39a34ff49..9958a1fb2a 100644 --- a/src/xrGame/FreeMP/game_sv_freemp.cpp +++ b/src/xrGame/FreeMP/game_sv_freemp.cpp @@ -8,6 +8,7 @@ #include "alife_time_manager.h" #include "restriction_space.h" +#include "../xrServerEntities/clsid_game.h" game_sv_freemp::game_sv_freemp() :pure_relcase(&game_sv_freemp::net_Relcase) @@ -246,6 +247,39 @@ void game_sv_freemp::OnPlayerReady(ClientID id_who) }; } +void game_sv_freemp::RespawnPlayer(ClientID id_who, bool NoSpectator) +{ + inherited::RespawnPlayer(id_who, NoSpectator); + + xrClientData* xrCData = (xrClientData*)m_server->ID_to_client(id_who); + if (!xrCData) return; + + game_PlayerState* ps = xrCData->ps; + if (!ps) return; + + CSE_ALifeCreatureActor* pA = smart_cast(xrCData->owner); + if (!pA) return; + + SpawnWeapon4Actor(pA->ID, "mp_players_rukzak", 0, ps->pItemList); +} + +void game_sv_freemp::OnDetach(u16 eid_who, u16 eid_what) +{ + CSE_ActorMP* e_who = smart_cast(m_server->ID_to_entity(eid_who)); + if (!e_who) + return; + + CSE_Abstract* e_entity = m_server->ID_to_entity(eid_what); + if (!e_entity) + return; + + // drop players bag + if (e_entity->m_tClassID == CLSID_OBJECT_PLAYERS_BAG) + { + OnDetachPlayersBag(e_who, e_entity); + } +} + // player disconnect void game_sv_freemp::OnPlayerDisconnect(ClientID id_who, LPSTR Name, u16 GameID) { @@ -274,6 +308,11 @@ void game_sv_freemp::OnEvent(NET_Packet& P, u16 type, u32 time, ClientID sender) KillPlayer(l_pC->ID, l_pC->ps->GameID); } break; + case GAME_EVENT_TRANSFER_MONEY: + { + OnTransferMoney(P, sender); + } + break; default: inherited::OnEvent(P, type, time, sender); }; diff --git a/src/xrGame/FreeMP/game_sv_freemp.h b/src/xrGame/FreeMP/game_sv_freemp.h index d753c3284b..31ebd2b38c 100644 --- a/src/xrGame/FreeMP/game_sv_freemp.h +++ b/src/xrGame/FreeMP/game_sv_freemp.h @@ -34,5 +34,14 @@ class game_sv_freemp : public game_sv_mp, private pure_relcase virtual void OnEvent(NET_Packet& tNetPacket, u16 type, u32 time, ClientID sender); virtual void Update(); + + virtual void RespawnPlayer(ClientID id_who, bool NoSpectator); virtual BOOL OnTouch(u16 eid_who, u16 eid_what, BOOL bForced = false); + virtual void OnDetach(u16 eid_who, u16 eid_what); + + // drop items after death + virtual void FillDeathActorRejectItems(CSE_ActorMP* actor, xr_vector& to_reject); + BOOL OnTouchPlayersBag(CSE_ActorMP* actor, CSE_Abstract* item); + void OnDetachPlayersBag(CSE_ActorMP* actor, CSE_Abstract* item); + }; \ No newline at end of file diff --git a/src/xrGame/FreeMP/game_sv_freemp_drop_items.cpp b/src/xrGame/FreeMP/game_sv_freemp_drop_items.cpp new file mode 100644 index 0000000000..b535e72844 --- /dev/null +++ b/src/xrGame/FreeMP/game_sv_freemp_drop_items.cpp @@ -0,0 +1,156 @@ +#include "stdafx.h" +#include "game_sv_freemp.h" +#include "clsid_game.h" +#include "actor_mp_client.h" +#include "Inventory.h" + +void game_sv_freemp::FillDeathActorRejectItems(CSE_ActorMP* actor, xr_vector& to_reject) +{ + R_ASSERT(actor); + CActor* pActor = smart_cast(Level().Objects.net_Find(actor->ID)); + + VERIFY2(pActor, make_string("Actor not found. actor_id = [%d]", actor->ID)); + if (!pActor) { + Msg("! ERROR: Actor not found. actor_id = [%d]", actor->ID); + return; + } + + u16 active_slot = pActor->inventory().GetActiveSlot(); + if (active_slot == KNIFE_SLOT || active_slot == BOLT_SLOT || active_slot == BINOCULAR_SLOT) + { + active_slot = NO_ACTIVE_SLOT; + } + + if (active_slot != NO_ACTIVE_SLOT) + { + PIItem item = pActor->inventory().ItemFromSlot(active_slot); + if (!item) + { + return; + } + CSE_Abstract* server_item = m_server->ID_to_entity(item->object_id()); + if (!server_item) + { + return; + } + + to_reject.push_back(server_item); + } +} + +BOOL game_sv_freemp::OnTouchPlayersBag(CSE_ActorMP* actor, CSE_Abstract* item) +{ + R_ASSERT(actor); + R_ASSERT(item); + + if (item->ID_Parent != 0xffff) + { + return TRUE; + } + + //move all items from rukzak to player + + if (!item->children.empty()) + { + NET_Packet EventPack; + NET_Packet PacketReject; + NET_Packet PacketTake; + + EventPack.w_begin(M_EVENT_PACK); + + while (!item->children.empty()) + { + CSE_Abstract* e_child_item = get_entity_from_eid(item->children.back()); + if (e_child_item) + { + if (!OnTouch(actor->ID, e_child_item->ID, FALSE)) + { + NET_Packet P; + u_EventGen(P, GE_OWNERSHIP_REJECT, item->ID); + P.w_u16(e_child_item->ID); + + m_server->Process_event_reject(P, m_server->GetServerClient()->ID, 0, item->ID, e_child_item->ID); + continue; + } + } + + m_server->Perform_transfer(PacketReject, PacketTake, e_child_item, item, actor); + + EventPack.w_u8(u8(PacketReject.B.count)); + EventPack.w(&PacketReject.B.data, PacketReject.B.count); + EventPack.w_u8(u8(PacketTake.B.count)); + EventPack.w(&PacketTake.B.data, PacketTake.B.count); + } + if (EventPack.B.count > 2) + u_EventSend(EventPack); + } + + //destroy the BAG + DestroyGameItem(item); + + return FALSE; +} + +void game_sv_freemp::OnDetachPlayersBag(CSE_ActorMP* actor, CSE_Abstract* item) +{ + R_ASSERT(actor); + R_ASSERT(item); + + //move all items from player to rukzak + xr_vector::const_iterator it_e = actor->children.end(); + + xr_vector to_transfer; + xr_vector to_destroy; + xr_vector to_reject; + + // may be there is a sense to move next invokation into the ProcessDeath method... + FillDeathActorRejectItems(actor, to_reject); + + for (auto it = actor->children.cbegin(); it != it_e; ++it) + { + u16 ItemID = *it; + CSE_Abstract* e_item = get_entity_from_eid(ItemID); + + R_ASSERT(e_item->ID_Parent == actor->ID); + + if (std::find(to_reject.begin(), to_reject.end(), e_item) != to_reject.end()) + continue; + + if ((e_item->m_tClassID == CLSID_OBJECT_W_KNIFE) || + (e_item->m_tClassID == CLSID_DEVICE_TORCH) || + (e_item->m_tClassID == CLSID_IITEM_BOLT)) + { + to_destroy.push_back(e_item); + } + else + { + if (!smart_cast(e_item) && e_item->m_tClassID != CLSID_OBJECT_PLAYERS_BAG) + { + to_transfer.push_back(e_item); + } + } + } + + NET_Packet EventPack; + NET_Packet PacketReject; + NET_Packet PacketTake; + EventPack.w_begin(M_EVENT_PACK); + + for (auto it = to_transfer.cbegin(); it != to_transfer.cend(); ++it) + { + m_server->Perform_transfer(PacketReject, PacketTake, *it, actor, item); + EventPack.w_u8(u8(PacketReject.B.count)); + EventPack.w(&PacketReject.B.data, PacketReject.B.count); + EventPack.w_u8(u8(PacketTake.B.count)); + EventPack.w(&PacketTake.B.data, PacketTake.B.count); + } + + if (EventPack.B.count > 2) + u_EventSend(EventPack); + + for (const auto& el : to_destroy) + DestroyGameItem(el); + + for (const auto& el : to_reject) + RejectGameItem(el); +} \ No newline at end of file diff --git a/src/xrGame/HUDTarget.cpp b/src/xrGame/HUDTarget.cpp index c669a4c581..d5f212072a 100644 --- a/src/xrGame/HUDTarget.cpp +++ b/src/xrGame/HUDTarget.cpp @@ -129,13 +129,11 @@ void CHUDTarget::CursorOnFrame () if(Level().ObjectSpace.RayQuery(RQR,RD, pick_trace_callback, &PP, nullptr, Level().CurrentEntity())) clamp (PP.RQ.range, NEAR_LIM, PP.RQ.range); } - } extern ENGINE_API BOOL g_bRendering; void CHUDTarget::Render() { - BOOL b_do_rendering = ( psHUD_Flags.is(HUD_CROSSHAIR|HUD_CROSSHAIR_RT|HUD_CROSSHAIR_RT2) ); if(!b_do_rendering) @@ -186,37 +184,39 @@ void CHUDTarget::Render() CEntityAlive* E_ = smart_cast(PP.RQ.O); CEntityAlive* pCurEnt = smart_cast(Level().CurrentEntity()); PIItem l_pI = smart_cast(PP.RQ.O); - + CActor* pActor = smart_cast (PP.RQ.O); CInventoryOwner* our_inv_owner = smart_cast(pCurEnt); - if (E_ && E_->g_Alive() && E_->cast_base_monster()) + if (E_ && E_->g_Alive()) { - C = C_ON_ENEMY; - } - else if (E_ && E_->g_Alive() && !E_->cast_base_monster()) - { - CInventoryOwner* others_inv_owner = smart_cast(E_); - - if (our_inv_owner && others_inv_owner) { - - switch (RELATION_REGISTRY().GetRelationType(others_inv_owner, our_inv_owner)) - { - case ALife::eRelationTypeEnemy: - C = C_ON_ENEMY; break; - case ALife::eRelationTypeNeutral: - C = C_ON_NEUTRAL; break; - case ALife::eRelationTypeFriend: - C = C_ON_FRIEND; break; - } + if (E_->cast_base_monster()) + { + C = C_ON_ENEMY; + } + else if (!pActor || (pActor && IsGameTypeSingleCompatible())) + { + CInventoryOwner* others_inv_owner = smart_cast(E_); - if (fuzzyShowInfo > 0.5f) + if (our_inv_owner && others_inv_owner) { - F->SetColor(subst_alpha(C, u8(iFloor(255.f * (fuzzyShowInfo - 0.5f) * 2.f)))); - F->OutNext("%s", *g_pStringTable->translate(others_inv_owner->Name())); - F->OutNext("%s", *g_pStringTable->translate(others_inv_owner->CharacterInfo().Community().id())); + switch (RELATION_REGISTRY().GetRelationType(others_inv_owner, our_inv_owner)) + { + case ALife::eRelationTypeEnemy: + C = C_ON_ENEMY; break; + case ALife::eRelationTypeNeutral: + C = C_ON_NEUTRAL; break; + case ALife::eRelationTypeFriend: + C = C_ON_FRIEND; break; + } + + if (fuzzyShowInfo > 0.5f) + { + F->SetColor(subst_alpha(C, u8(iFloor(255.f * (fuzzyShowInfo - 0.5f) * 2.f)))); + F->OutNext("%s", *g_pStringTable->translate(others_inv_owner->Name())); + F->OutNext("%s", *g_pStringTable->translate(others_inv_owner->CharacterInfo().Community().id())); + } } } - fuzzyShowInfo += SHOW_INFO_SPEED * Device.fTimeDelta; } else if (l_pI && our_inv_owner && PP.RQ.range < 2.0f * 2.0f) diff --git a/src/xrGame/InventoryOwner.cpp b/src/xrGame/InventoryOwner.cpp index 5940d71ddd..a7753f5568 100644 --- a/src/xrGame/InventoryOwner.cpp +++ b/src/xrGame/InventoryOwner.cpp @@ -406,6 +406,11 @@ LPCSTR CInventoryOwner::Name () const return m_game_name.c_str(); } +void CInventoryOwner::SetName(LPCSTR name) +{ + m_game_name = name; +} + LPCSTR CInventoryOwner::IconName () const { return CharacterInfo().IconName().c_str(); diff --git a/src/xrGame/InventoryOwner.h b/src/xrGame/InventoryOwner.h index 33d719b3b6..55fb477fd2 100644 --- a/src/xrGame/InventoryOwner.h +++ b/src/xrGame/InventoryOwner.h @@ -99,6 +99,7 @@ class CInventoryOwner : public CAttachmentOwner { //игровое имя virtual LPCSTR Name () const; + void SetName(LPCSTR name); LPCSTR IconName () const; u32 get_money () const {return m_money;} void set_money (u32 amount, bool bSendEvent); diff --git a/src/xrGame/Level.cpp b/src/xrGame/Level.cpp index d6e86de70e..9b3a42ae6e 100644 --- a/src/xrGame/Level.cpp +++ b/src/xrGame/Level.cpp @@ -187,6 +187,7 @@ CLevel::CLevel():IPureClient (Device.GetTimerGlobal()) m_game_graph = 0; m_chunk = 0; spawn = 0; + } extern CAI_Space *g_ai_space; @@ -317,6 +318,7 @@ CLevel::~CLevel() FS.r_close(spawn); } + shared_str CLevel::name () const { return (map_data.m_name); diff --git a/src/xrGame/Level.h b/src/xrGame/Level.h index 7bb5569b15..d221eecc22 100644 --- a/src/xrGame/Level.h +++ b/src/xrGame/Level.h @@ -15,6 +15,8 @@ #include "secure_messaging.h" #include "../xrEngine/xr_level_controller.h" +#include "game_cl_base.h" + class CHUDManager; class CParticlesObject; class xrServer; @@ -39,6 +41,7 @@ class demo_info; class CDebugRenderer; #endif + extern float g_fov; const int maxRP = 64; @@ -472,7 +475,6 @@ IC CPHCommander & CLevel::ph_commander_physics_worldstep() IC bool OnServer() { return Level().IsServer();} IC bool OnClient() { return Level().IsClient();} IC bool IsGameTypeSingle() { return (g_pGamePersistent->GameType() == eGameIDSingle);}; - bool IsGameTypeSingleCompatible(); //class CPHWorld; diff --git a/src/xrGame/alife_simulator.cpp b/src/xrGame/alife_simulator.cpp index dcdb2d7489..1a6e115698 100644 --- a/src/xrGame/alife_simulator.cpp +++ b/src/xrGame/alife_simulator.cpp @@ -57,14 +57,20 @@ CALifeSimulator::CALifeSimulator (xrServer *server, shared_str *command_line) : typedef IGame_Persistent::params params; params &p = g_pGamePersistent->m_game_params; - string256 temp; + bool is_single = !xr_strcmp(p.m_game_type, "single"); + + if (is_single) + { + string256 temp; xr_strcpy (temp,p.m_game_or_spawn); xr_strcat (temp,"/"); xr_strcat (temp,p.m_game_type); xr_strcat (temp,"/"); xr_strcat (temp,p.m_alife); *command_line = temp; - + + } + LPCSTR start_game_callback = pSettings->r_string(alife_section,"start_game_callback"); luabind::functor functor; R_ASSERT2 (ai().script_engine().functor(start_game_callback,functor),"failed to get start game callback"); @@ -75,9 +81,7 @@ CALifeSimulator::CALifeSimulator (xrServer *server, shared_str *command_line) : load_from_editor(); return; } - - if (!xr_strcmp(p.m_game_type, "single")) - { + if (is_single) { load(p.m_game_or_spawn, !xr_strcmp(p.m_new_or_load, "load") ? false : true, !xr_strcmp(p.m_new_or_load, "new")); } else //if(!xr_strcmp(p.m_alife, "alife")) diff --git a/src/xrGame/console_commands_mp.cpp b/src/xrGame/console_commands_mp.cpp index a80ed64ca4..6ecd24b7ab 100644 --- a/src/xrGame/console_commands_mp.cpp +++ b/src/xrGame/console_commands_mp.cpp @@ -1174,6 +1174,8 @@ class CCC_ListPlayers : public IConsole_Command { if (!g_pGameLevel || !Level().Server || !Level().Server->game) return; u32 cnt = Level().Server->game->get_players_count(); + if (g_dedicated_server) + cnt--; Msg("- Total Players : %d", cnt); Msg("- ----player list begin-----"); struct PlayersEnumerator @@ -1186,17 +1188,20 @@ class CCC_ListPlayers : public IConsole_Command { void operator()(IClient* client) { xrClientData *l_pC = (xrClientData*)client; - if (!l_pC) + if (!l_pC || !l_pC->ps) + return; + + if (g_dedicated_server && l_pC->ID == Level().Server->GetServerClient()->ID) return; ip_address Address; DWORD dwPort = 0; Level().Server->GetClientAddress(client->ID, Address, &dwPort); string512 tmp_string; - xr_sprintf(tmp_string, "- (player session id : %u), (name : %s), (ip: %s), (ping: %u);", - client->ID.value(), + xr_sprintf(tmp_string, "- (player session id : %u), (name : %s), (ip: %s), (ping: %u), (money: %d);", client->ID.value(), l_pC->ps->getName(), Address.to_string().c_str(), - l_pC->ps->ping); + l_pC->ps->ping, + l_pC->ps->money_for_round); if (filter_string) { if (strstr(tmp_string, filter_string)) diff --git a/src/xrGame/ui/UIActorMenu.cpp b/src/xrGame/ui/UIActorMenu.cpp index 9f513814ab..938e3a7c49 100644 --- a/src/xrGame/ui/UIActorMenu.cpp +++ b/src/xrGame/ui/UIActorMenu.cpp @@ -57,7 +57,7 @@ void CUIActorMenu::SetActor(CInventoryOwner* io) } else { - UpdateActorMP(); + SetActorInfoMP(); } } @@ -880,25 +880,40 @@ void CUIActorMenu::ResetMode() SetCurrentItem (nullptr); } -void CUIActorMenu::UpdateActorMP() +void CUIActorMenu::UpdateActorMoneyMP() { if ( !&Level() || !Level().game || !Game().local_player || !m_pActorInvOwner || IsGameTypeSingle() ) { - m_ActorCharacterInfo->ClearInfo(); - m_ActorMoney->SetText( "" ); + m_ActorMoney->SetText(""); return; } - int money = Game().local_player->money_for_round; + s32 money = Game().local_player->money_for_round; string64 buf; xr_sprintf( buf, "%d RU", money ); m_ActorMoney->SetText( buf ); +} + +void CUIActorMenu::SetActorInfoMP() +{ + if (!&Level() || !Level().game || !Game().local_player || !m_pActorInvOwner || IsGameTypeSingle()) + { + m_ActorCharacterInfo->ClearInfo(); + return; + } - m_ActorCharacterInfo->InitCharacterMP( Game().local_player->getName(), "ui_npc_u_nebo_1" ); + if (IsGameTypeSingleCompatible()) + { + m_ActorCharacterInfo->InitCharacterMP(m_pActorInvOwner); + } + else + { + m_ActorCharacterInfo->InitCharacterMP(Game().local_player->getName(), "ui_npc_u_nebo_1"); + } + UpdateActorMoneyMP(); } - bool CUIActorMenu::CanSetItemToList(PIItem item, CUIDragDropListEx* l, u16& ret_slot) { u16 item_slot = item->BaseSlot(); diff --git a/src/xrGame/ui/UIActorMenu.h b/src/xrGame/ui/UIActorMenu.h index 95116a8f8e..7e8364b2c8 100644 --- a/src/xrGame/ui/UIActorMenu.h +++ b/src/xrGame/ui/UIActorMenu.h @@ -271,7 +271,8 @@ class CUIActorMenu : public CUIDialogWnd, bool TryUseItem (CUICellItem* cell_itm); bool ToQuickSlot (CUICellItem* itm); - void UpdateActorMP (); + void SetActorInfoMP(); + void UpdateActorMoneyMP(); void UpdateOutfit (); void MoveArtefactsToBag (); bool TryActiveSlot (CUICellItem* itm); diff --git a/src/xrGame/ui/UIActorMenuTrade.cpp b/src/xrGame/ui/UIActorMenuTrade.cpp index 18d7f42f87..798f768a09 100644 --- a/src/xrGame/ui/UIActorMenuTrade.cpp +++ b/src/xrGame/ui/UIActorMenuTrade.cpp @@ -328,7 +328,7 @@ void CUIActorMenu::UpdateActor() } else { - UpdateActorMP(); + UpdateActorMoneyMP(); } CActor* actor = smart_cast( m_pActorInvOwner ); diff --git a/src/xrGame/ui/UICharacterInfo.cpp b/src/xrGame/ui/UICharacterInfo.cpp index e90fbe888d..3537bc3312 100644 --- a/src/xrGame/ui/UICharacterInfo.cpp +++ b/src/xrGame/ui/UICharacterInfo.cpp @@ -235,6 +235,38 @@ void CUICharacterInfo::InitCharacter(u16 id) */ } +void CUICharacterInfo::InitCharacterMP(CInventoryOwner* invOwner) +{ + ClearInfo(); + + if (m_icons[eName]) + { + m_icons[eName]->TextItemControl()->SetText(invOwner->Name()); + m_icons[eName]->Show(true); + } + + m_texture_name = invOwner->IconName(); + if (m_icons[eIcon]) + { + m_icons[eIcon]->InitTexture(m_texture_name.c_str()); + m_icons[eIcon]->Show(true); + } + if (m_icons[eIconOver]) + { + m_icons[eIconOver]->Show(true); + } + if (m_icons[eCommunity]) + { + m_icons[eCommunity]->TextItemControl()->SetTextST(invOwner->CharacterInfo().Community().id().c_str()); + m_icons[eCommunity]->Show(true); + } + if (m_icons[eReputation]) + { + m_icons[eReputation]->TextItemControl()->SetTextST(GetReputationAsText(invOwner->CharacterInfo().Reputation().value())); + m_icons[eReputation]->Show(true); + } +} + void CUICharacterInfo::InitCharacterMP(LPCSTR player_name, LPCSTR player_icon) { ClearInfo(); diff --git a/src/xrGame/ui/UICharacterInfo.h b/src/xrGame/ui/UICharacterInfo.h index a63f66324e..db3e9420b1 100644 --- a/src/xrGame/ui/UICharacterInfo.h +++ b/src/xrGame/ui/UICharacterInfo.h @@ -6,11 +6,12 @@ #include "../../xrUI/Widgets/uiwindow.h" #include "../../xrEngine/AI/alife_space.h" #include "character_info_defs.h" - class CUIStatic; class CCharacterInfo; class CUIXml; class CUIScrollView; +class CInventoryOwner; + class CUICharacterInfo: public CUIWindow { private: @@ -68,6 +69,9 @@ class CUICharacterInfo: public CUIWindow void InitCharacter (u16 id); void ClearInfo (); + + void InitCharacterMP (CInventoryOwner* invOwner); + void InitCharacterMP (LPCSTR player_name, LPCSTR player_icon ); virtual void Update ();