| 2088 | } |
| 2089 | |
| 2090 | void SpawnItem(int m, int x, int y, BOOL sendmsg) |
| 2091 | { |
| 2092 | int ii, onlygood, idx; |
| 2093 | |
| 2094 | if (monster[m]._uniqtype || ((monster[m].MData->mTreasure & 0x8000) && gbMaxPlayers != 1)) { |
| 2095 | idx = RndUItem(m); |
| 2096 | if (idx < 0) { |
| 2097 | SpawnUnique(-(idx + 1), x, y); |
| 2098 | return; |
| 2099 | } |
| 2100 | onlygood = 1; |
| 2101 | } else if (quests[QTYPE_BLKM]._qactive != 2 || quests[QTYPE_BLKM]._qvar1 != QS_MUSHGIVEN) { |
| 2102 | idx = RndItem(m); |
| 2103 | if (!idx) |
| 2104 | return; |
| 2105 | if (idx > 0) { |
| 2106 | idx--; |
| 2107 | onlygood = 0; |
| 2108 | } else { |
| 2109 | SpawnUnique(-(idx + 1), x, y); |
| 2110 | return; |
| 2111 | } |
| 2112 | } else { |
| 2113 | idx = IDI_BRAIN; |
| 2114 | quests[QTYPE_BLKM]._qvar1 = QS_BRAINSPAWNED; |
| 2115 | } |
| 2116 | |
| 2117 | if (numitems < MAXITEMS) { |
| 2118 | ii = itemavail[0]; |
| 2119 | GetSuperItemSpace(x, y, ii); |
| 2120 | itemavail[0] = itemavail[MAXITEMS - numitems - 1]; |
| 2121 | itemactive[numitems] = ii; |
| 2122 | if (monster[m]._uniqtype) { |
| 2123 | SetupAllItems(ii, idx, GetRndSeed(), monster[m].MData->mLevel, 15, onlygood, FALSE, FALSE); |
| 2124 | } else { |
| 2125 | SetupAllItems(ii, idx, GetRndSeed(), monster[m].MData->mLevel, 1, onlygood, FALSE, FALSE); |
| 2126 | } |
| 2127 | numitems++; |
| 2128 | if (sendmsg) |
| 2129 | NetSendCmdDItem(FALSE, ii); |
| 2130 | } |
| 2131 | } |
| 2132 | |
| 2133 | void CreateItem(int uid, int x, int y) |
| 2134 | { |
no test coverage detected