| 2116 | } |
| 2117 | |
| 2118 | void OperateChest(const Player &player, Object &chest, bool sendLootMsg) |
| 2119 | { |
| 2120 | if (chest._oSelFlag == 0) { |
| 2121 | return; |
| 2122 | } |
| 2123 | |
| 2124 | PlaySfxLoc(IS_CHEST, chest.position); |
| 2125 | chest._oSelFlag = 0; |
| 2126 | chest._oAnimFrame += 2; |
| 2127 | SetRndSeed(chest._oRndSeed); |
| 2128 | if (setlevel) { |
| 2129 | for (int j = 0; j < chest._oVar1; j++) { |
| 2130 | CreateRndItem(chest.position, true, sendLootMsg, false); |
| 2131 | } |
| 2132 | } else { |
| 2133 | for (int j = 0; j < chest._oVar1; j++) { |
| 2134 | if (chest._oVar2 != 0) |
| 2135 | CreateRndItem(chest.position, false, sendLootMsg, false); |
| 2136 | else |
| 2137 | CreateRndUseful(chest.position, sendLootMsg); |
| 2138 | } |
| 2139 | } |
| 2140 | if (chest.IsTrappedChest()) { |
| 2141 | Direction mdir = GetDirection(chest.position, player.position.tile); |
| 2142 | MissileID mtype; |
| 2143 | switch (chest._oVar4) { |
| 2144 | case 0: |
| 2145 | mtype = MissileID::Arrow; |
| 2146 | break; |
| 2147 | case 1: |
| 2148 | mtype = MissileID::FireArrow; |
| 2149 | break; |
| 2150 | case 2: |
| 2151 | mtype = MissileID::Nova; |
| 2152 | break; |
| 2153 | case 3: |
| 2154 | mtype = MissileID::RingOfFire; |
| 2155 | break; |
| 2156 | case 4: |
| 2157 | mtype = MissileID::StealPotions; |
| 2158 | break; |
| 2159 | case 5: |
| 2160 | mtype = MissileID::StealMana; |
| 2161 | break; |
| 2162 | default: |
| 2163 | mtype = MissileID::Arrow; |
| 2164 | } |
| 2165 | AddMissile(chest.position, player.position.tile, mdir, mtype, TARGET_PLAYERS, -1, 0, 0); |
| 2166 | chest._oTrapFlag = false; |
| 2167 | } |
| 2168 | if (&player == MyPlayer) |
| 2169 | NetSendCmdLoc(MyPlayerId, false, CMD_OPERATEOBJ, chest.position); |
| 2170 | } |
| 2171 | |
| 2172 | void OperateMushroomPatch(const Player &player, Object &mushroomPatch) |
| 2173 | { |
no test coverage detected