bool CHARACTER::SellItem(TItemPos Cell) { LPITEM item = NULL; if (!CanHandleItem()) return false; if (IsDead() || IsStun()) return false; if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell))) return false; if (true == item->isLocked() || item->IsExchanging() || item->IsEquipped()) return false; if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true) return false; if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_SELL)) return false; // EXTRA_CHECK int iPulse = thecore_pulse(); if (iPulse - GetSafeboxLoadTime() < PASSES_PER_SEC(g_nPortalLimitTime) || iPulse - GetRefineTime() < PASSES_PER_SEC(g_nPortalLimitTime) || iPulse - GetMyShopTime() < PASSES_PER_SEC(g_nPortalLimitTime)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please wait a second.")); return false; } if (item->GetCount() <= 0) return false; DWORD dwPrice = item->GetShopBuyPrice(); dwPrice *= item->GetCount(); const int64_t nTotalMoney = static_cast(GetGold()) + static_cast(dwPrice); if (GOLD_MAX <= nTotalMoney) { sys_err("[OVERFLOW_GOLD] id %u name %s gold %u", GetPlayerID(), GetName(), GetGold()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("20억냥이 초과하여 물품을 팔수 없습니다.")); return false; } item->SetCount(item->GetCount() - item->GetCount()); PointChange(POINT_GOLD, dwPrice, false); DBManager::instance().SendMoneyLog(MONEY_LOG_SHOP, item->GetVnum(), dwPrice); char buf[1024]; char itemlink[256]; int len; len = snprintf(itemlink, sizeof(itemlink), "item:%x:%x", item->GetVnum(), item->GetFlag()); for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x", item->GetSocket(i)); for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; ++i) if (item->GetAttributeType(i) != 0) len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d", item->GetAttributeType(i), item->GetAttributeValue(i)); snprintf(buf, sizeof(buf), "|cffffc700|H%s|h[%s]|h|r", itemlink, item->GetName()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You succesfully sell %s."), buf); return true; }